From 27665d9f9df60f1614a187afe1e928c667040b4c Mon Sep 17 00:00:00 2001 From: Andrey Astakhov Date: Fri, 25 Mar 2016 12:44:48 +0100 Subject: [PATCH 1/2] Fixed wrong code examples for Isbn constraint The example in the annotations code block causes an exception '[Semantical Error] Couldn't find constant isbn10'. It happens because attribute values in annotation blocks must be quoted. Additionally I fixed PHP code block to use quoted attribute also there --- reference/constraints/Isbn.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/reference/constraints/Isbn.rst b/reference/constraints/Isbn.rst index 6883f0e1aa4..9fd444bc052 100644 --- a/reference/constraints/Isbn.rst +++ b/reference/constraints/Isbn.rst @@ -57,8 +57,8 @@ on an object that will contain an ISBN. { /** * @Assert\Isbn( - * type = isbn10, - * message: This value is not valid. + * type = "isbn10", + * message: "This value is not valid." * ) */ protected $isbn; @@ -97,7 +97,7 @@ on an object that will contain an ISBN. public static function loadValidatorMetadata(ClassMetadata $metadata) { $metadata->addPropertyConstraint('isbn', new Assert\Isbn(array( - 'type' => isbn10, + 'type' => 'isbn10', 'message' => 'This value is not valid.' ))); } From cafd11219740785e2668e6f35831fb00a55dd6a2 Mon Sep 17 00:00:00 2001 From: Andrey Astakhov Date: Fri, 25 Mar 2016 12:56:35 +0100 Subject: [PATCH 2/2] Changed colon to equal sign in annotation block --- reference/constraints/Isbn.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reference/constraints/Isbn.rst b/reference/constraints/Isbn.rst index 9fd444bc052..3e7b17086a5 100644 --- a/reference/constraints/Isbn.rst +++ b/reference/constraints/Isbn.rst @@ -58,7 +58,7 @@ on an object that will contain an ISBN. /** * @Assert\Isbn( * type = "isbn10", - * message: "This value is not valid." + * message = "This value is not valid." * ) */ protected $isbn;