Hello.. I had this issue.. you need to put in the primary_key the field that is unique.
In this case: 'primary_key' => 'user_name' Rgds, Lic. Matías López E-mail: lopezmat...@gmail.com Movil: +54 9 341 155 799291 On Wed, Mar 11, 2009 at 10:49 PM, Benjamin <agtle...@gmail.com> wrote: > > I spoke too soon. Now it allows you to create multiple entries with > the same user name. I've spent about 12 hours researching this, I > read the form book, looked through all the tutorials, looked at the > api documentation and search good for hours. Can someone please for > the love of god help me figure out how to get this validator to work > right? > > On Mar 11, 5:24 pm, Benjamin <agtle...@gmail.com> wrote: > > I'm going to leave this up in case anyone else has the same problem. > > The answer is that you must specify the primary key, if the unique > > field is not the primary key. Here is a working example: > > > > [code=php] > > new sfValidatorPropelUnique( > > array( > > 'model' => 'Members', > > 'column' => array('user_name', 'id'), > > ), > > array( > > 'invalid' => 'This user name has already been taken', > > ) > > ), > > [/code] > > > > On Mar 11, 3:50 am, Benjamin <agtle...@gmail.com> wrote: > > > > > > > > > The code is below. I have been searching for hours. This is failing > > > on updates, saying that the user name has already been taken. It's > > > being used as a post validator. > > > > > new sfValidatorPropelUnique( > > > array( > > > 'model' => 'Members', > > > 'column' => array('user_name'), > > > ), > > > array( > > > 'invalid' => 'This user name has already been taken', > > > )), > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---