"unique = true" . . , , , . , -...
EDIT: ( ).
loooooot , .
, : https://groups.google.com/forum/#!topic/symfony2/veb6Leph2_w
So, I used the same solution: try / catch. I just have to assume that the only exception thrown by the database is a unique violation of restrictions ...
try {
$this->persistAndFlush($user);
return $this->redirect($this->generateUrl('publish'));
}
catch (\PDOException $e) {
$error = $this->trans('user.username.notUnique',array(),'validators');
}
This is not satisfactory, but it works. And I have lost enough time with this for today.
Reply to vegemite4me: Sorry, but I am not familiar with Stackoverflow. I did not find the comment button, and now I see the only one I can answer. But it doesn’t work ... Either I’m out of luck, or I’m noob, or the form is very poorly made. Probably three of them
source
share