-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Form] Add support for Validation Group Sequences without using entities #5665
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Is there any estimated time when someone will start to work on this feature? It is hard to do that? |
Finally I found a solution for my problem: class MyCustomConstraintValidator extends ConstraintValidator
{
public function validate($value, Constraint $constraint)
{
$has_violation = false;
foreach ($this->context->getViolations()->getIterator() as $violation) {
if ($violation->getPropertyPath() == $this->context->getPropertyPath()) {
$has_violation = true;
break;
}
}
if (!$has_violation) {
$this->context->addViolation($constraint->message, array('%string%' => $value));
}
}
} |
This method is very useful for me. Maybe make a pull request? |
Ok, no one cares. Just made myself an alternative class ContraintValidator and will use it instead |
Hi @moldcraft, thank you for your commitment and your patience on this issue. I opened a new related ticket #7146. In addition to that ticket, the Form component should support $form = $factory->create('myform', null, array(
'constraints' => array(...),
'validation_groups' => new GroupSequence(array('first', 'second')),
)); I'll leave this ticket open as feature request, but I cannot give an estimation yet on when this will be implemented. |
something new with this ? |
This should be possible since #10287. |
Recently found out about validation group sequences from #2947.
I'm fairly convinced after looking through the form component that it does not support them if you are adding constraints within the form type, and have no entity with which to apply the sequence.
The purpose of this feature request is to add support for validation group sequences in the form component.
The text was updated successfully, but these errors were encountered: