Skip to content

Double validation for constraints on Interface #19516

@steevanb

Description

@steevanb

Hi !

I have this kind of code :

interface FooInterface {}
abstract class AbstractBar implements FooInterface{}
class Baz extends AbstractBar {}

$object = new Baz();
$validator->validate($object, null, ['validator_group']);

If i create a constraints validator on AbstractBar, like this :

AbstractBar:
    constraints:
        - MyConstraint:
            groups: [validator_group]

MyConstraint is called once.

But if i just change AbstractBar by FooInterface in config :

FooInterface:
    constraints:
        - MyConstraint:
            groups: [validator_group]

MyConstraint is called twice !

I can't search why for now, someone could do it please ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions