Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[Validator] Valid constraint traverse option not working when using as Attribute #46243

Copy link
Copy link
Closed
@tobias-93

Description

@tobias-93
Issue body actions

Symfony version(s) affected

5.4

Description

The traverse option doesn't work when using a Valid constraint as Attribute.

How to reproduce

use Symfony\Component\Validator\Constraints as Assert;

// var will not be traversed
class SomeAnnotationClass {
  /** @Assert\Valid(traverse=false) */
  private $someVar;
}

// var WILL be traversed
class SomeAttributeClass {
  #[Assert\Valid(traverse: false)]
  private $someVar;
}

Possible Solution

The constructor of Symfony\Component\Validator\Constraints\Valid isn't overridden (like many other constraints) to add the traverse named option.

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.