Skip to content

[Validator] Exclude patterns in auto mapping #32015

Closed
@alanpoulain

Description

@alanpoulain

Description
Like autowiring/autoconfiguration, it should be possible to define an exclude glob patterns for the new auto mapping feature.

This way, it should be possible to add auto mapping for an entire directory (like App\Entity\) and to exclude some files in it (like App\Entity\User).

Example
I'm not sure how we could add this feature with the current way to configure it.

Today we can do:

framework:
    validation:
        auto_mapping:
            App\Entity\: ['validator.property_info_loader']

With this configuration, only the validator.property_info_loader is used to load the validation constraints.

Maybe something like this would be okay, to look like the services configuration?

framework:
    validation:
        auto_mapping:
            include:
                App\Entity\: []
            exclude:
                - App\Entity\User

It would mean the previous way of configuring it would add the mapping to the include key.

WDYT?

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