-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Validation not taken into account in promotion configuration forms #1295
Comments
Reproduced this on local... Still valid unfortunately. |
@pjedrzejewski I am interested into fixing this issue. Any directions? |
@umpirsky According to docs (http://symfony.com/doc/current/book/forms.html#adding-validation), you can just add validation groups to constraint like this: new NotBlank(array('groups' => array('sylius')) Tell me if it works :) |
@michalmarcinkowski This did the trick, thanks! But, why it does not work with: class MyConfigurationType extends AbstractType
{
public function setDefaultOptions(OptionsResolverInterface $resolver)
{
$resolver
->setDefaults(array(
'validation_groups' => ['sylius'],
))
;
}
} |
@umpirsky Not sure what are you asking. If the form is embedded I suppose it may be connected with cascade validation (http://symfony.com/doc/current/reference/forms/types/form.html#cascade-validation) Is that your case? |
@michalmarcinkowski Yes, but that is the case with all rule checker config types. They are embedded by default. |
As validation_groups is set to
sylius
by default, Symfony's Form Component does not validate any of the Constraints set in Forms.This is a big issue for configuration of promotions which have no underlying object to validate. Only an array.
On a fresh install of Sylius, I just added GreaterThan in ItemCountConfigurationType.
I could saved a -1 value in the item_count_configuration of New Year Promotion
The text was updated successfully, but these errors were encountered: