From 9c2616e788159987308a7d23bc0bbaa897509bbd Mon Sep 17 00:00:00 2001 From: Jakub Zalas Date: Thu, 29 May 2014 08:58:28 +0100 Subject: [PATCH] [Validator] Remove property and method targets from the optional and required constraints. At the moment both constraints can only be defined on other annotations (specifically, the Collection annotation). Defining the required or optional annotation directly on a field or method throws a ClassNotFoundException, since the constraint validator factory tries to load the validator (which does not exist). --- src/Symfony/Component/Validator/Constraints/Optional.php | 2 +- src/Symfony/Component/Validator/Constraints/Required.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/Validator/Constraints/Optional.php b/src/Symfony/Component/Validator/Constraints/Optional.php index 36b615f3f3..dab8b4371f 100644 --- a/src/Symfony/Component/Validator/Constraints/Optional.php +++ b/src/Symfony/Component/Validator/Constraints/Optional.php @@ -13,7 +13,7 @@ namespace Symfony\Component\Validator\Constraints; /** * @Annotation - * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) + * @Target({"ANNOTATION"}) * * @author Bernhard Schussek */ diff --git a/src/Symfony/Component/Validator/Constraints/Required.php b/src/Symfony/Component/Validator/Constraints/Required.php index 66ced405e9..bd77a909f9 100644 --- a/src/Symfony/Component/Validator/Constraints/Required.php +++ b/src/Symfony/Component/Validator/Constraints/Required.php @@ -13,7 +13,7 @@ namespace Symfony\Component\Validator\Constraints; /** * @Annotation - * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) + * @Target({"ANNOTATION"}) * * @author Bernhard Schussek */