[FLOW3-general] A question about partial validation

Sebastian Kurfürst sebastian at typo3.org
Mon Jan 21 12:21:20 CET 2013


Hey François,

sorry for not anwering before, seems this mail slipped through my 
attention.

let me elaborate a bit more on the "partial validation" features; as it 
is not tied to any "controller" or "action", but it can be used for that.

Basically, it allows to "tag" validators inside your domain models with 
one or multiple "validation groups"; this is what you do calling
     @Flow\Validate(type="NotEmpty", validationGroups={"createAction"})

I'd probably rather call the validation group "creation", or 
"creationOnly", as it shows more clearly that we did not tag the 
validator invocation with a "Controller action", but instead with an 
"abstract group name".
If no validator groups are specified in a model property, the validation 
group " Default" is assigned to it.


Then, during *invocation of the validation*, inside a controller, you 
can specify the *validation groups* of validators which should be only 
taken into account. A validator is only executed if at least one 
validation group overlap.

This means, you add an annotation 
@Flow\ValidationGroups({"creationOnly"}) to your controller to indicate 
that only validators tagged with this validation group are executed.

Does that make more sense? Do you have any hint on how to improve the 
manual in this area? That's at least also what I tried to write in the 
manual; but it does not seem clear enough yet.

Greets,
Sebastian


More information about the Flow mailing list