Doctrine 1
  1. Doctrine 1
  2. DC-167

Adding a foreign key to the uniqueBy option of a Sluggable doesn't work

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.2.0-ALPHA3
    • Fix Version/s: 1.2.0-BETA1
    • Component/s: Behaviors
    • Labels:
      None
    • Environment:
      A freshly installed symfony 1.3-BETA1, but the doctrine svn still has it

      Description

      I'm trying to set the uniqueBy option of a Sluggable to a foreign key (in an articles table, I want the slug to be unique by category). This fails because the query checking if the slug exists doesn't return any records, as it doesn't use the correct where paramter.
      The problem is in Doctrine/Template/Listener/Sluggable.php:172, adding the whereParam expects a value, but a class (containing the relationship object) is given.

              foreach ($this->_options['uniqueBy'] as $uniqueBy) {
                  if (is_null($record->$uniqueBy)) {
                      $whereString .= ' AND r.'.$uniqueBy.' IS NULL';
                  } else {
                      $whereString .= ' AND r.'.$uniqueBy.' = ?';
                      $whereParams[] =  $record->$uniqueBy;
                  }
              }
      

        Activity

        There are no comments yet on this issue.

          People

          • Assignee:
            Jonathan H. Wage
            Reporter:
            Gunther Konig
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: