Shouldn't these be two different validators? That'd be less magic. I'm thinking about explicitely disallowing validators to be used both for classes and properties by introducing new classes ClassConstraint and PropertyConstraint. Then it'd be easier to check for errors (Max is not allowed to be put on classes, for instance).
What do you think about this? Bernhard -- Software Architect & Engineer Blog: http://webmozarts.com Twitter: http://twitter.com/webmozart 2011/1/14 Lukas Kahwe Smith <m...@pooteeweet.org>: > Hi Bernhard, > > I am wondering how I can write a unique validator that works both on the > class level and on the property level: > https://github.com/FriendsOfSymfony/UserBundle/blob/master/Validator/Unique.php > > Right now there is a required "property" option, which can be a comma > separated list of properties to check for uniqueness. For a class level > validator that makes sense, but the same validator also supports being set on > a property. So in that case I would like to make the "property" option > unsupported and instead figure out the property somehow from the constraint > instance. > > So my questions: > 1) how can I determine if the validator is class or property level inside the > Unique class? > 2) how can I determine the name of the property from the constraint instance? > > regards, > Lukas Kahwe Smith > m...@pooteeweet.org > > > > -- 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 developers" group. To post to this group, send email to symfony-devs@googlegroups.com To unsubscribe from this group, send email to symfony-devs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-devs?hl=en