Skip to content

Fixed wrong code examples for Isbn constraint #6399

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
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
  • Loading branch information
a-ast committed Mar 25, 2016
commit 27665d9f9df60f1614a187afe1e928c667040b4c
6 changes: 3 additions & 3 deletions reference/constraints/Isbn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The colon should be the equals character too, shouldn't it?

* )
*/
protected $isbn;
Expand Down Expand Up @@ -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.'
)));
}
Expand Down