Skip to content

GroupSequences execute next group if first fail #25717

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

Closed
sobhan93 opened this issue Jan 8, 2018 · 6 comments
Closed

GroupSequences execute next group if first fail #25717

sobhan93 opened this issue Jan 8, 2018 · 6 comments

Comments

@sobhan93
Copy link

sobhan93 commented Jan 8, 2018

Q A
Bug report? yes
Feature request? no
BC Break report? no
RFC? no
Symfony version 4.0.3

When form is submitted, both groups "Users' and 'Strict' are validated even if there are violations in 'Users'.

When put something like "123" on username and password,expected "This value is too short. It should have 6 characters or more." but "I am passwordLegal" message appears.

class Users
{
    public static function loadValidatorMetadata(ClassMetadata $metadata)
    {
        $metadata->addPropertyConstraint('username', new Assert\NotBlank());
        $metadata->addPropertyConstraint('password', new Assert\NotBlank());
        $metadata->addPropertyConstraint('username', new Assert\Length(array(
            'min' => 6,
            'max' => 12
        )));
        
        $metadata->addPropertyConstraint('password', new Assert\Length(array(
            'min' => 6
        )));
        
        $metadata->addGetterMethodConstraint('password', 'passwordLegal', new Assert\IsTrue(array(
            'message' => 'The password cannot match your username',
            'groups' => array(
                'Strict'
            )
        )));
        $metadata->setGroupSequence(array(
            'Users',
            'Strict'
        ));
    }

    public function passwordLegal()
    {
        die("I am passwordLegal");
        return $this->password !== $this->username;
    }
}
@xabbuh
Copy link
Member

xabbuh commented Jan 8, 2018

Would you be able to provide a fully working example application that allows to reproduce your issue?

@sobhan93
Copy link
Author

sobhan93 commented Jan 8, 2018

Example Application

URL: /signup

@xabbuh
Copy link
Member

xabbuh commented Jan 8, 2018

Status: Reviewed

@sobhan93
Copy link
Author

sobhan93 commented Jan 9, 2018

When will this bug be solved ?

@xabbuh
Copy link
Member

xabbuh commented Jan 9, 2018

There is no schedule for when bugs are fixed. At some point, someone will decide to work on an issue and submit a PR. But that depends on how complicated things are, how many people are affected and so on. If more people are affected by an issue, changes are high, that one of them will invest some time themselves to fix the code.

@xabbuh
Copy link
Member

xabbuh commented Sep 24, 2018

Actually, this is a duplicate of #9939. Therefore, I am closing here.

@xabbuh xabbuh closed this as completed Sep 24, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants