Skip to content

[Validator] Add the fields option to the Unique constraint #15592

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
17 changes: 16 additions & 1 deletion reference/constraints/Unique.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ If you want to apply any other comparison logic, use the `normalizer`_ option.

========== ===================================================================
Applies to :ref:`property or method <validation-property-target>`
Options - `groups`_
Options - `fields`_
- `groups`_
- `message`_
- `normalizer`_
- `payload`_
Expand Down Expand Up @@ -107,6 +108,20 @@ strings:
Options
-------

``fields``
~~~~~~~~~~

**type**: ``array`` [:ref:`default option <validation-default-option>`]


.. versionadded:: 5.4

The ``fields`` option was introduced in Symfony 5.4.

This is optional and is an array defining all of the
keys in the collection that should be checked for uniqueness.
By default, all collection keys are checked for uniqueness.

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

``message``
Expand Down