Skip to content

[Validator] UniqueEntity - add warning about not supported types and association mappings. #21262

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

Open
wants to merge 3 commits into
base: 6.4
Choose a base branch
from
Open
Changes from all commits
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
9 changes: 9 additions & 0 deletions reference/constraints/UniqueEntity.rst
Original file line number Diff line number Diff line change
Expand Up @@ -402,4 +402,13 @@ blank, ``findBy()`` will be used. The method receives as its argument a
fields configured in the ``fields`` option). The method should return a
:phpfunction:`countable PHP variable <is_countable>`.

.. warning::

This constraint does not support Doctrine types such as ``simple_array``,
``json``, or ``jsonb``, nor does it handle association mappings like
``One-To-Many`` and ``Many-To-Many`` relationships. It may also not work
correctly with custom Doctrine types. To perform uniqueness checks on
such fields, you must define a custom ``repositoryMethod`` that
implements the desired logic.

.. _`race conditions`: https://en.wikipedia.org/wiki/Race_condition