Skip to content

Commit

Permalink
minor #6399 Fixed wrong code examples for Isbn constraint (AAstakhov)
Browse files Browse the repository at this point in the history
This PR was submitted for the 2.5 branch but it was merged into the 2.7 branch instead (closes #6399).

Discussion
----------

Fixed wrong code examples for Isbn constraint

| Q             | A
| ------------- | ---
| Doc fix?      | yes
| New docs?     | no
| Applies to    | 2.5+
| Fixed tickets | n/a

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

Commits
-------

503c07c Fixed wrong code examples for Isbn constraint
  • Loading branch information
xabbuh committed Mar 26, 2016
2 parents e7246b6 + 503c07c commit 66051f7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions reference/constraints/Isbn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,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;
Expand Down Expand Up @@ -99,7 +99,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.'
)));
}
Expand Down

0 comments on commit 66051f7

Please sign in to comment.