Skip to content

[Validator] Use more realistic example #15383

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 2 commits into from
Closed
Changes from 1 commit
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
10 changes: 5 additions & 5 deletions reference/constraints/Compound.rst
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ You can now use it anywhere you need it:
/**
* @AcmeAssert\PasswordRequirements()
*/
public $password;
public $plainPassword;
}

.. code-block:: php-attributes
Expand All @@ -110,15 +110,15 @@ You can now use it anywhere you need it:
class RegisterUser
{
#[AcmeAssert\PasswordRequirements]
public $password;
public $plainPassword;
}

.. code-block:: yaml

# config/validator/validation.yaml
App\User\RegisterUser:
properties:
password:
plainPassword:
- App\Validator\Constraints\PasswordRequirements: ~

.. code-block:: xml
Expand All @@ -130,7 +130,7 @@ You can now use it anywhere you need it:
xsi:schemaLocation="http://symfony.com/schema/dic/constraint-mapping https://symfony.com/schema/dic/constraint-mapping/constraint-mapping-1.0.xsd">

<class name="App\User\RegisterUser">
<property name="password">
<property name="plainPassword">
<constraint name="App\Validator\Constraints\PasswordRequirements"/>
</property>
</class>
Expand All @@ -148,7 +148,7 @@ You can now use it anywhere you need it:
{
public static function loadValidatorMetadata(ClassMetadata $metadata)
{
$metadata->addPropertyConstraint('password', new AcmeAssert\PasswordRequirements());
$metadata->addPropertyConstraint('plainPassword', new AcmeAssert\PasswordRequirements());
}
}

Expand Down