Permalink
Browse files

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
  • Loading branch information...
weaverryan committed Mar 26, 2014
2 parents cad38ae + b9f8b8d commit d7027c07ad7f4037e07d15944d8c2d5e389926a9
Showing with 8 additions and 5 deletions.
  1. +8 −5 book/validation.rst
View
@@ -583,8 +583,11 @@ Getters
Constraints can also be applied to the return value of a method. Symfony2
allows you to add a constraint to any public method whose name starts with
"get" or "is". In this guide, both of these types of methods are referred
to as "getters".
"get", "is" or "has". In this guide, these types of methods are referred to
as "getters".
.. versionadded:: 2.5
Support for methods starting with ``has`` was introduced in Symfony 2.5.
The benefit of this technique is that it allows you to validate your object
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::
.. note::
The keen-eyed among you will have noticed that the prefix of the getter
("get" or "is") is omitted in the mapping. This allows you to move the
constraint to a property with the same name later (or vice versa) without
changing your validation logic.
("get", "is" or "has") is omitted in the mapping. This allows you to move
the constraint to a property with the same name later (or vice versa)
without changing your validation logic.
.. _validation-class-target:

0 comments on commit d7027c0

Please sign in to comment.