Hi all, I'm getting in trouble using sfvalidatordoctrineunique (Symfony 1.2.8, Doctrine, Ubuntu). This method validates the uniqueness of a column.
According to API (http://www.symfony-project.org/api/1_2/ sfValidatorDoctrineUnique), we should be able to add several fields in options (columns index) using an array but it doesn't work. When I try to add a new entry (already in DB), program runs as if nothing was set and throws an exception: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '1-1' for key 1 Here is a summary of schema.yml: I have a table named 'championship_season' which its primary key is composed of 2 foreign keys: "championship_id" and "season_id" (to be explicit, there is NO "id" column auto_increment). I used doctrine admin generator to create all forms. In lib/form/doctrine/ChampionshipSeasonForm.php, I firstly had to change both fields from "hidden inputs" (as they are primary keys) to "dropdown lists". $this->widgetSchema['season_id'] = new sfWidgetFormDoctrineChoice(array ('model' => 'Season', 'add_empty' => false)); $this->widgetSchema['championship_id'] = new sfWidgetFormDoctrineChoice(array('model' => 'Championship', 'add_empty' => false)); Then, I've added the following code to detect duplicated entry attempt: $this->validatorSchema->setPostValidator( new sfValidatorDoctrineUnique(array( 'model' => 'ChampionshipSeason', 'column' => array('season_id', 'championship_id'), 'required' => true )) ); As I explained before, when I try to add an entry already in the database, I get the SQL error message (see above) instead of a message from sfvalidatordoctrineunique. Please let me know your thoughts about this issue. Thanks. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~----------~----~----~----~------~----~------~--~---