There is another thing that troubled me a bit today which I think is quite common, and that is conditional validation. Something like if field A has a specific value, then field B should also have a specific value. Partly, such cases can be covered by different validation groups, but that is not possible in all cases. If different validation groups are not suitable, then I still have the option to write a custom validator. However, a custom validator only works if fields A and B are simple values, if field B is also an object itself which possibly has constraints, then I have no way (or am I missing something here?) to validate the object graph below that point.
I've created a gist to demonstrate the problem: https://gist.github.com/997961 There are also some good blog posts on this (warning Java ahead): - http://www.lunatech-research.com/archives/2008/05/09/bean-validation-java-ee(towards the end) - https://forum.hibernate.org/viewtopic.php?t=985722 I'm not sure what the best solution is here, one that I can think of is that we need a re-entry point for validation that can be invoked dynamically from a class constraint validator. The other option would be to make the GraphWalker more extensible and allow to overwrite the behavior of which properties should be visited, or skipped dynamically. Johannes On Sun, May 29, 2011 at 7:00 PM, ryan weaver <[email protected]> wrote: > I'm still worried about "required" defaulting to true, as well as how the > required option is "guessed". My impression is that the "required" option is > only guessed from validation if you use field guessing, meaning that as soon > as I actually define a field to be, for example, a "textarea" type instead > of a "text" type, that required option goes back to defaulting to true. So, > overall, I'm worried about how decoupled the "required" option is from > validation. > > Additionally, does anyone know the status with file uploading? I'm also > still worried about the following points: > > * Is it intentional that the "preferred_choices" in the ChoiceType does not > work when expanded=true? > > * For the ChoiceType, you have to set required=false to get an "empty" > option at the top of your select field. That seems wrong - I can have a > required select menu, but I don't want to auto-select the first option for > the user. I think these should be separated - and driven entirely by the > presence/absence of the user passing in an "empty_value" option to the form > helper > > Thanks! > > Ryan Weaver > US Office Head & Trainer - KnpLabs - Nashville, TN > http://www.knplabs.com <http://www.knplabs.com/en> > http://www.thatsquality.com > Twitter: @weaverryan > > > On Fri, May 27, 2011 at 11:20 AM, Kevin <[email protected]> wrote: > >> Any update on the "Required Attribute" issue. I find it annoying to >> be set as true by default. >> >> On May 4, 6:15 pm, Venzon <[email protected]> wrote: >> > How to changeformname when using type "form" in createBuilder. For >> > example here: >> > >> > $form= $this->get('form.factory') >> > ->createBuilder('form', $product) >> > ->add('name', 'text') >> > ->getForm(); >> > >> > Formwill be named "form". How to change it to something else? When I >> > change "form" to something else I get type error. >> >> -- >> 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 [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-devs?hl=en >> > > -- > 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 [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-devs?hl=en > -- 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 [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-devs?hl=en
