Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 42007cb

Browse filesBrowse files
krisdantejaviereguiluz
authored andcommitted
Replaces ProtocolClassValidator for the second example
Examples for Class Constraint Validator use ContainsAlphanumeric that was added as property validator. It will not work for a class. The intention of the second example seems to be the usage of ProtocolClassValidator introduced in this section (chapter).
1 parent 6bea43f commit 42007cb
Copy full SHA for 42007cb

File tree

Expand file treeCollapse file tree

1 file changed

+4
-4
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+4
-4
lines changed

‎validation/custom_constraint.rst

Copy file name to clipboardExpand all lines: validation/custom_constraint.rst
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ The validator class is also simple, and only has one required method ``validate(
6868
if (!$constraint instanceof ContainsAlphanumeric) {
6969
throw new UnexpectedTypeException($constraint, ContainsAlphanumeric::class);
7070
}
71-
71+
7272
// custom constraints should ignore null and empty values to allow
7373
// other constraints (NotBlank, NotNull, etc.) take care of that
7474
if (null === $value || '' === $value) {
@@ -214,7 +214,7 @@ not to the property:
214214
.. code-block:: php-annotations
215215
216216
/**
217-
* @AcmeAssert\ContainsAlphanumeric
217+
* @AcmeAssert\ProtocolClassValidator
218218
*/
219219
class AcmeEntity
220220
{
@@ -226,11 +226,11 @@ not to the property:
226226
# src/AppBundle/Resources/config/validation.yml
227227
AppBundle\Entity\AcmeEntity:
228228
constraints:
229-
- AppBundle\Validator\Constraints\ContainsAlphanumeric: ~
229+
- AppBundle\Validator\Constraints\ProtocolClassValidator: ~
230230
231231
.. code-block:: xml
232232
233233
<!-- src/AppBundle/Resources/config/validation.xml -->
234234
<class name="AppBundle\Entity\AcmeEntity">
235-
<constraint name="AppBundle\Validator\Constraints\ContainsAlphanumeric" />
235+
<constraint name="AppBundle\Validator\Constraints\ProtocolClassValidator" />
236236
</class>

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.