You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I created the following form where I remove a field for certain cases, but when I add it, i want it to be validated, but only then.
If I would add the assert to the entity it actually would validate it even if it is not added by the validator, since the entity would
not match its "notBlank" assert.
As said in the forum you can only validate array-like values with a CollectionConstraint (and not objects).
I added #3114 to provide support for dynamic constraints, which might be the solution for that problem in the future.
But there is another solution for your problem: You could define a CallbackConstraint and validate the field manually. I'll post an example in the forum
As said, the Collection constraint can not be used to validate normal objects. You should use validation groups to control which constraints are applied on your object.
I created the following form where I remove a field for certain cases, but when I add it, i want it to be validated, but only then.
If I would add the assert to the entity it actually would validate it even if it is not added by the validator, since the entity would
not match its "notBlank" assert.
In general the form works, except, when I get to the validation, I get the following error:
Even though I felt, I followed the symfony2 docs (http://symfony.com/doc/current/book/forms.html#adding-validation).
Bug or Stupidity? :)
Need help there.
The text was updated successfully, but these errors were encountered: