From bfe3a203e33a53f5b581bcafa9be67a261067a97 Mon Sep 17 00:00:00 2001 From: Philipp Rieber Date: Sat, 4 Jan 2014 11:47:25 +0100 Subject: [PATCH 1/3] [Validation] Add "hasser" support --- book/validation.rst | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/book/validation.rst b/book/validation.rst index ea5315afaae..ca2880f5881 100644 --- a/book/validation.rst +++ b/book/validation.rst @@ -583,8 +583,8 @@ 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". 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 +665,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: From bb9004ef6cd181fd7fba1f6d7dae1e2c5e129b3f Mon Sep 17 00:00:00 2001 From: Philipp Rieber Date: Sat, 4 Jan 2014 19:09:24 +0100 Subject: [PATCH 2/3] Add "versionadded" directive for 2.5 --- book/validation.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/book/validation.rst b/book/validation.rst index ca2880f5881..4168ae079bb 100644 --- a/book/validation.rst +++ b/book/validation.rst @@ -586,6 +586,9 @@ allows you to add a constraint to any public method whose name starts with "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`` is new 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 doesn't match the first name of the user (for security reasons). You can From b9f8b8d5cbb603ca538889ac29e2e122e78ccfdc Mon Sep 17 00:00:00 2001 From: Philipp Rieber Date: Sun, 5 Jan 2014 13:13:10 +0100 Subject: [PATCH 3/3] fix "versionadded" wording --- book/validation.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/book/validation.rst b/book/validation.rst index 4168ae079bb..9d253930917 100644 --- a/book/validation.rst +++ b/book/validation.rst @@ -587,7 +587,7 @@ allows you to add a constraint to any public method whose name starts with as "getters". .. versionadded:: 2.5 - Support for methods starting with ``has`` is new in Symfony 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