8000 [Validator] `Valid` constraint `traverse` option not working when using as Attribute · Issue #46243 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content
[Validator] Valid constraint traverse option not working when using as Attribute #46243
Closed
@tobias-93

Description

@tobias-93

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

      0