Hi! I have a question on how to build an effective validation system in 
Symfony2+Doctrine. 
I want to make sure that my entity will never be stored in DB in incorrect 
state. Also, I want to use symfony validation to display validation errors 
in forms in correct way.
So I've implented service, which subscribed for prePersist and preUpdate 
events for entities, obtains via DIC Symfony Validator, runs validation and 
if symfony validation error occured - throws an Exception.
Are there any possible problems with this approach?

Another problem is binding some validation checks to corresponding form 
fields. As far as i understand, getPropertyPath is used to retrieve data 
from ConstraintViolations and to "bind" error to corresponding form field. I 
have a method isClosureDateAfterLaunchDate which validates field 
'closureDate' of my entity (via @validation:assertTrue). How can I tell 
Symfony this validation relates to closureDate field?

I've just looked at recent API (I'm using PR8 right now) and it looks like 
CallbackValidator can help me with this problem. Are there any examples how 
to use it?

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

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

Reply via email to