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

[Validation] Allow multiple atPath()s at callback constraint #36544

Copy link
Copy link
Closed
@ThomasLandauer

Description

@ThomasLandauer
Issue body actions

Description
It would be handy to add the same violation to multiple form fields, if you want to display the same error message at two fields, e.g. "You need to provide either your name or your email address"

https://symfony.com/doc/current/reference/constraints/Callback.html

Example
The (for the user) easiest way would be to just repeat atPath():

$context->buildViolation('...')->atPath('name')->atPath('email')->addViolation();

Instead of having to repeat the entire violation (current status quo):

$context->buildViolation('...')->atPath('name')->addViolation();
$context->buildViolation('...')->atPath('email')->addViolation();

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.