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

Commit ee2ab69

Browse filesBrowse files
committed
feature symfony#6932 Explain the limitations of the custom messages in UniqueEntity (javiereguiluz)
This PR was submitted for the 2.8 branch but it was merged into the 3.1 branch instead (closes symfony#6932). Discussion ---------- Explain the limitations of the custom messages in UniqueEntity This fixes symfony#6929. Thanks goes to @HeahDude, who made all the "detective work" to find this limitation. Commits ------- 4c10ea8 Explain the limitations of the custom messages in UniqueEntity
2 parents 36a460d + 4c10ea8 commit ee2ab69
Copy full SHA for ee2ab69

File tree

Expand file treeCollapse file tree

1 file changed

+12
-1
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+12
-1
lines changed

‎reference/constraints/UniqueEntity.rst

Copy file name to clipboardExpand all lines: reference/constraints/UniqueEntity.rst
+12-1Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,18 @@ message
132132

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

135-
The message that's displayed when this constraint fails.
135+
The message that's displayed when this constraint fails. This message is always
136+
mapped to the first field causing the violation, even when using multiple fields
137+
in the constraint.
138+
139+
.. versionadded:: 3.1
140+
The ability to include the invalid value into the message was introduced
141+
in Symfony 3.1.
142+
143+
Messages can include the ``{{ value }}`` placeholder to display a string
144+
representation of the invalid entity. If the entity doesn't define the
145+
``__toString()`` method, the following generic value will be used: *"Object of
146+
class __CLASS__ identified by <comma separated IDs>"*
136147

137148
em
138149
~~

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.