Hadrien Boyé írta:
> in my model, i have a table called "person" with unique constraint on
> "name" and "surname" columns.
>
> then, i want to prevent duplicates creations by retrieving a message to
> the user if once tries to create an existing person.
>
> at the moment, i use my own validator (inspired by
> "propelUniqueValidator") which performs a "select" on the database and
> retrieve an error if the data already exists.
>
> if possible, i would like to avoid this preliminar request by catching
> and handling the "duplicate entry" propel exception ("Unable to execute
> INSERT statement . . . Duplicate entry . . .") thrown by propel when i
> perform the "insert" request.
>
> my very problem is that this exception has no particular code (0) then i
> don't know how to catch it !
you could catch all propel exceptions and then match its message on
'Duplicate entry' - if it matches, handle it yourself, if not just throw
it on
greets,
Zoltán Németh
>
> how do you handle this kind of "duplicate creation" scenario ? any idea ?
>
> >
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---