Skip to content

Commit 976b613

Browse files
authored
Update UniqueEntity.rst
1 parent 956ed61 commit 976b613

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

reference/constraints/UniqueEntity.rst

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ using an email address that already exists in the system.
1212

1313
.. versionadded:: 5.2
1414

15-
Not entity (like DTO) field (or fields) validation against entities persisted in the database, was introduced in Symfony 5.2.
15+
Any class instance (like DTO) field (or fields) validation against entities persisted in the database was introduced in Symfony 5.2.
1616

1717
========== ===================================================================
1818
Applies to :ref:`class <validation-class-target>`
@@ -150,7 +150,7 @@ the current class instance. However, in some cases, such as when using Doctrine
150150
inheritance mapping, you need to execute the query in a different repository.
151151
Use this option to define the fully-qualified class name (FQCN) of the Doctrine
152152
entity associated with the repository you want to use.
153-
Another case is when the validated object is not an entity.
153+
Another case is when the object being validated is not an entity.
154154

155155
errorPath
156156
~~~~~~~~~
@@ -267,22 +267,27 @@ each with a single field.
267267

268268
.. include:: /reference/constraints/_groups-option.rst.inc
269269

270+
If object being validated field name(s) do not match the ones from the entity,
271+
use key-value mapping; Where ``key`` is the name of the field in the object being
272+
validated and ``value`` is the name of the field in the entity.
273+
Field name(s) mapping only applies when the object being validated is not an entity.
270274

271275
identifierFieldNames
272276
~~~~~~~~~~~~~~~~~~~~
273277

274278
**type**: ``array`` | ``string`` [:ref:`default option <validation-default-option>`]
275279

276-
Use it only when the validated object is not an entity and you need to update an entity.
280+
Use it only when the object being validated is not an entity and you need to update an
281+
entity with it.
277282
This option is the identifier field name that is the ``primary key`` or the identifier
278-
field names that are ``composite keys`` in the entity set by the `entityClass`_ option.
279-
283+
field names that are ``composite keys`` in the entity class set by the `entityClass`_
284+
option.
280285
If set, it won’t trigger a uniqueness constraint violation when the only not unique
281286
entity identifier(s) value(s) will be matching corresponding value(s) from the
282-
validated object.
283-
If validated object field names do not match the ones from the entity,
284-
use key-value mapping; Where ``key`` is the name of the field in the validated object
285-
and ``value`` is the name of the field in the entity.
287+
object being validated.
288+
If object being validated field name(s) do not match the ones from the entity,
289+
use key-value mapping; Where ``key`` is the name of the field in the object being
290+
validated and ``value`` is the name of the field in the entity.
286291

287292
Consider this example:
288293

0 commit comments

Comments
 (0)