From 5832e0320195586e6e5567eb72384164c76dd176 Mon Sep 17 00:00:00 2001 From: wkania Date: Fri, 1 Aug 2025 18:11:39 +0200 Subject: [PATCH 1/3] [Validator] UniqueEntity - add warning about not supported types and association mappings. 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. To perform uniqueness checks on such fields, you must define a custom repositoryMethod that implements the desired logic. --- reference/constraints/UniqueEntity.rst | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/reference/constraints/UniqueEntity.rst b/reference/constraints/UniqueEntity.rst index 0e1731371a5..cb15688a3a4 100644 --- a/reference/constraints/UniqueEntity.rst +++ b/reference/constraints/UniqueEntity.rst @@ -402,4 +402,12 @@ 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 `. +.. 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. 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 From 9c7e2da95b1291ec4949d4a12d7127699584d7ce Mon Sep 17 00:00:00 2001 From: wkania Date: Fri, 1 Aug 2025 18:15:19 +0200 Subject: [PATCH 2/3] Fix spaces --- reference/constraints/UniqueEntity.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/reference/constraints/UniqueEntity.rst b/reference/constraints/UniqueEntity.rst index cb15688a3a4..21128140294 100644 --- a/reference/constraints/UniqueEntity.rst +++ b/reference/constraints/UniqueEntity.rst @@ -404,8 +404,8 @@ fields configured in the ``fields`` option). The method should return a .. warning:: - This constraint does not support Doctrine types such as ``simple_array``, - ``json``, or ``jsonb``, nor does it handle association mappings like + 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. To perform uniqueness checks on such fields, you must define a custom ``repositoryMethod`` that implements the desired logic. From 74dd6a86faeff5ddba3c8baf2ed687dfdb825eaa Mon Sep 17 00:00:00 2001 From: wkania Date: Sat, 2 Aug 2025 21:49:49 +0200 Subject: [PATCH 3/3] Update UniqueEntity.rst --- reference/constraints/UniqueEntity.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/reference/constraints/UniqueEntity.rst b/reference/constraints/UniqueEntity.rst index 21128140294..51c24c27cbd 100644 --- a/reference/constraints/UniqueEntity.rst +++ b/reference/constraints/UniqueEntity.rst @@ -406,8 +406,9 @@ fields configured in the ``fields`` option). The method should return a 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. To perform uniqueness - checks on such fields, you must define a custom ``repositoryMethod`` that + ``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