Hi.

I have a User form that includes a 'username' field and a database
table & schema.yml that lists this field as 'Unique'.

However, when I test my application and try to add another user with a
username that is already used elsewhere I get this unfriendly error in
my browser:

[B]500 | Internal Server Error | PropelException
Unable to execute INSERT statement. [wrapped: SQLSTATE[23000]:
Integrity constraint violation: 1062 Duplicate entry 'droberts' for
key 2]
stack trace

    * at ()
      in SF_SYMFONY_LIB_DIR\plugins\sfPropelPlugin\lib\vendor\propel
\util\BasePeer.php line 299 ...
             296.
             297.         } catch (Exception $e) {
             298.             Propel::log($e->getMessage(),
Propel::LOG_ERR);
             299.             throw new PropelException("Unable to
execute INSERT statement.", $e);
             300.         }
             301.
             302.         // If the primary key column is auto-
incremented, get the id now.[/B]

I have got a post validator set to ensure that the 'username' field is
unique but the 'cleaner' error from this validator is never
displayed.  Here is my validator:

[CODE]$this->validatorSchema->setPostValidator(
      new sfValidatorPropelUnique(array('model' => 'User', 'column' =>
'username'))
    );[/CODE]

There is also a standard sfValidatorString validation further up in
the code as below:

[CODE]'username'        => new sfValidatorString(array('max_length' =>
20)),[/CODE]

Could anyone explain why the 500 error is being generated instead of a
validation error message please?

Thank you for your time.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to