8000 Add doc for UniqueEntity `ignoreNull` by VincentLanglet · Pull Request #18337 · symfony/symfony-docs · GitHub
[go: up one dir, main page]

Skip to content

Add doc for UniqueEntity ignoreNull #18337

8000
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 1 commit into from
Closed
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
7 changes: 6 additions & 1 deletion reference/constraints/UniqueEntity.rst
Original file line number Diff line number Diff line change
Expand Up @@ -251,13 +251,18 @@ each with a single field.
``ignoreNull``
~~~~~~~~~~~~~~

**type**: ``boolean`` **default**: ``true``
**type**: ``boolean`` | ``array`` | ``string`` **default**: ``true``

If this option is set to ``true``, then the constraint will allow multiple
entities to have a ``null`` value for a field without failing validation.
If set to ``false``, only one ``null`` value is allowed - if a second entity
also has a ``null`` value, validation would fail.

As of Symfony 6.3, the ``UniqueEntity`` constraint allows you to ignore null
values on specific fields when checking for uniqueness. This feature can be
helpful when you want to validate the uniqueness of a combination of fields,
but want to exclude combinations where one or more of the fields are null.

``message``
~~~~~~~~~~~

Expand Down
0