Skip to content

Commit b34f46a

Browse files
committed
Merge pull request #2297 from michaelperrin/fix/ref-UniquePassword-depr
[Reference] [UserPassword] Use the non-deprecated class for Symfony 2.2
2 parents b38edbc + 7fd28f2 commit b34f46a

File tree

1 file changed

+25
-17
lines changed

1 file changed

+25
-17
lines changed

reference/constraints/UserPassword.rst

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@ UserPassword
44
.. versionadded:: 2.1
55
This constraint is new in version 2.1.
66

7+
.. note::
8+
9+
Since Symfony 2.2, the `UserPassword*` classes in the
10+
`Symfony\Component\Security\Core\Validator\Constraint` namespace are
11+
deprecated and will be removed in Symfony 2.3. Please use the
12+
`UserPassword*` classes in the
13+
`Symfony\Component\Security\Core\Validator\Constraints` namespace instead.
14+
715
This validates that an input value is equal to the current authenticated
816
user's password. This is useful in a form where a user can change his password,
917
but needs to enter his old password for security.
@@ -13,15 +21,15 @@ but needs to enter his old password for security.
1321
This should **not** be used to validate a login form, since this is done
1422
automatically by the security system.
1523

16-
+----------------+-------------------------------------------------------------------------------------------+
17-
| Applies to | :ref:`property or method<validation-property-target>` |
18-
+----------------+-------------------------------------------------------------------------------------------+
19-
| Options | - `message`_ |
20-
+----------------+-------------------------------------------------------------------------------------------+
21-
| Class | :class:`Symfony\\Component\\Security\\Core\\Validator\\Constraint\\UserPassword` |
22-
+----------------+-------------------------------------------------------------------------------------------+
23-
| Validator | :class:`Symfony\\Component\\Security\\Core\\Validator\\Constraint\\UserPasswordValidator` |
24-
+----------------+-------------------------------------------------------------------------------------------+
24+
+----------------+--------------------------------------------------------------------------------------------+
25+
| Applies to | :ref:`property or method<validation-property-target>` |
26+
+----------------+--------------------------------------------------------------------------------------------+
27+
| Options | - `message`_ |
28+
+----------------+--------------------------------------------------------------------------------------------+
29+
| Class | :class:`Symfony\\Component\\Security\\Core\\Validator\\Constraints\\UserPassword` |
30+
+----------------+--------------------------------------------------------------------------------------------+
31+
| Validator | :class:`Symfony\\Component\\Security\\Core\\Validator\\Constraints\\UserPasswordValidator` |
32+
+----------------+--------------------------------------------------------------------------------------------+
2533

2634
Basic Usage
2735
-----------
@@ -39,16 +47,16 @@ password:
3947
Acme\UserBundle\Form\Model\ChangePassword:
4048
properties:
4149
oldPassword:
42-
- Symfony\Component\Security\Core\Validator\Constraint\UserPassword:
50+
- Symfony\Component\Security\Core\Validator\Constraints\UserPassword:
4351
message: "Wrong value for your current password"
4452
4553
.. code-block:: php-annotations
4654
4755
// src/Acme/UserBundle/Form/Model/ChangePassword.php
4856
namespace Acme\UserBundle\Form\Model;
49-
50-
use Symfony\Component\Security\Core\Validator\Constraint as SecurityAssert;
51-
57+
58+
use Symfony\Component\Security\Core\Validator\Constraints as SecurityAssert;
59+
5260
class ChangePassword
5361
{
5462
/**
@@ -63,7 +71,7 @@ password:
6371
6472
<!-- src/UserBundle/Resources/config/validation.xml -->
6573
<class name="Acme\UserBundle\Form\Model\ChangePassword">
66-
<property name="Symfony\Component\Security\Core\Validator\Constraint\UserPassword">
74+
<property name="Symfony\Component\Security\Core\Validator\Constraints\UserPassword">
6775
<option name="message">Wrong value for your current password</option>
6876
</property>
6977
</class>
@@ -72,10 +80,10 @@ password:
7280
7381
// src/Acme/UserBundle/Form/Model/ChangePassword.php
7482
namespace Acme\UserBundle\Form\Model;
75-
83+
7684
use Symfony\Component\Validator\Mapping\ClassMetadata;
77-
use Symfony\Component\Security\Core\Validator\Constraint as SecurityAssert;
78-
85+
use Symfony\Component\Security\Core\Validator\Constraints as SecurityAssert;
86+
7987
class ChangePassword
8088
{
8189
public static function loadValidatorData(ClassMetadata $metadata)

0 commit comments

Comments
 (0)