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 d7027c0

Browse filesBrowse files
committed
feature #3418 [Validation] Add "hasser" support (bicpi)
This PR was merged into the master branch. Discussion ---------- [Validation] Add "hasser" support | Q | A | ------------- | --- | Doc fix? | no | New docs? | yes (symfony/symfony#9097) | Applies to | master | Fixed tickets | - Commits ------- b9f8b8d fix "versionadded" wording bb9004e Add "versionadded" directive for 2.5 bfe3a20 [Validation] Add "hasser" support
2 parents cad38ae + b9f8b8d commit d7027c0
Copy full SHA for d7027c0

File tree

Expand file treeCollapse file tree

1 file changed

+8
-5
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+8
-5
lines changed

‎book/validation.rst

Copy file name to clipboardExpand all lines: book/validation.rst
+8-5Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -583,8 +583,11 @@ Getters
583583

584584
Constraints can also be applied to the return value of a method. Symfony2
585585
allows you to add a constraint to any public method whose name starts with
586-
"get" or "is". In this guide, both of these types of methods are referred
587-
to as "getters".
586+
"get", "is" or "has". In this guide, these types of methods are referred to
587+
as "getters".
588+
589+
.. versionadded:: 2.5
590+
Support for methods starting with ``has`` was introduced in Symfony 2.5.
588591

589592
The benefit of this technique is that it allows you to validate your object
590593
dynamically. For example, suppose you want to make sure that a password field
@@ -665,9 +668,9 @@ Now, create the ``isPasswordLegal()`` method, and include the logic you need::
665668
.. note::
666669

667670
The keen-eyed among you will have noticed that the prefix of the getter
668-
("get" or "is") is omitted in the mapping. This allows you to move the
669-
constraint to a property with the same name later (or vice versa) without
670-
changing your validation logic.
671+
("get", "is" or "has") is omitted in the mapping. This allows you to move
672+
the constraint to a property with the same name later (or vice versa)
673+
without changing your validation logic.
671674

672675
.. _validation-class-target:
673676

0 commit comments

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