Skip to content

Explain the limitations of the custom messages in UniqueEntity #6932

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion reference/constraints/UniqueEntity.rst
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,11 @@ message

**type**: ``string`` **default**: ``This value is already used.``

The message that's displayed when this constraint fails.
The message that's displayed when this constraint fails. When using multiple
fields, the ``{{ vallue }}`` parameter only contains the value of the first
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually {{ value }} represents the entity, but only the first invalid field will trigger a violation to its path

wrong field. Therefore, you cannot define a custom message that displays all
the wrong values (e.g. the following won't work:
``This {{ name }} name and {{ email }} email combination is in use. Change either of them``)

em
~~
Expand Down