Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
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;
}
}