Skip to content

Commit 0591adf

Browse files
committed
Added Some updates
1 parent d79e7df commit 0591adf

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

reference/constraints/Isbn.rst

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ on an object that will contain a ISBN number.
2828

2929
.. code-block:: yaml
3030
31-
# src/Acme/DemoBundle/Resources/config/validation.yml
32-
Acme\DemoBundle\Entity\AcmeEntity:
31+
# src/Acme/BookcaseBunlde/Resources/config/validation.yml
32+
Acme\BookcaseBunlde\Entity\Book:
3333
properties:
3434
isbn:
3535
- Isbn:
@@ -39,8 +39,8 @@ on an object that will contain a ISBN number.
3939
4040
.. code-block:: xml
4141
42-
<!-- src/Acme/DemoBundle/Resources/config/validation.xml -->
43-
<class name="Acme\DemoBundle\Entity\AcmeEntity">
42+
<!-- src/Acme/BookcaseBunlde/Resources/config/validation.xml -->
43+
<class name="Acme\BookcaseBunlde\Entity\Book">
4444
<property name="isbn">
4545
<constraint name="Isbn">
4646
<option name="isbn10">true</option>
@@ -52,10 +52,10 @@ on an object that will contain a ISBN number.
5252
5353
.. code-block:: php-annotations
5454
55-
// src/Acme/DemoBundle/Entity/AcmeEntity.php
55+
// src/Acme/BookcaseBunlde/Entity/Book.php
5656
use Symfony\Component\Validator\Constraints as Assert;
5757
58-
class AcmeEntity
58+
class Book
5959
{
6060
/**
6161
* @Assert\Isbn(
@@ -69,17 +69,19 @@ on an object that will contain a ISBN number.
6969
7070
.. code-block:: php
7171
72-
// src/Acme/DemoBundle/Entity/AcmeEntity.php
72+
// src/Acme/BookcaseBunlde/Entity/Book.php
73+
namespace Acme\BookcaseBunlde\Entity;
74+
7375
use Symfony\Component\Validator\Mapping\ClassMetadata;
74-
use Symfony\Component\Validator\Constraints\Isbn;
76+
use Symfony\Component\Validator\Constraints as Assert;
7577
76-
class AcmeEntity
78+
class Book
7779
{
7880
protected $isbn;
7981
8082
public static function loadValidatorMetadata(ClassMetadata $metadata)
8183
{
82-
$metadata->addPropertyConstraint('isbn', new Isbn(array(
84+
$metadata->addPropertyConstraint('isbn', new Assert\Isbn(array(
8385
'isbn10' => true,
8486
'isbn13' => true,
8587
'bothIsbnMessage' => 'This value is neither a valid ISBN-10 nor a valid ISBN-13.'
@@ -128,4 +130,4 @@ isbn13
128130
**type**: ``boolean`` [:ref:`default option<validation-default-option>`]
129131

130132
If this required option is set to ``true`` the constraint will check
131-
if the code is a valid ISBN-13 code.
133+
if the code is a valid ISBN-13 code.

0 commit comments

Comments
 (0)