问题
If I have many validators against my entity, can I somehow specify one that it stops the rest if it fails? IE: there's no point checking Permissions if it fails NotBlank.
Alternatively, if its not built in, perhaps theres a way to signal the graph walker to stop, and I can put in a validator that checks for prior failures and stops propagation through the graph.
回答1:
If you set the validation in ./app/config/validation.yml
then SF2 will validate as the order of validations in the file. Once a validation is failed, it ignore the others.
来源:https://stackoverflow.com/questions/10135345/how-to-stop-validation-on-constraint-failure-in-symfony2