11Isbn
22====
33
4- .. versionadded :: New in version 2.3:
5- The Isbn validation were added in Symfony 2.3.
4+ .. versionadded :: 2.3
5+ The Isbn constraint was added in Symfony 2.3.
66
7- This constraint permits that a ISBN (International Standard Book Numbers)
8- number is either a valid ISBN-10, a valid ISBN-13 code or both on a value .
7+ This constraint validates that an ISBN (International Standard Book Numbers)
8+ number is either a valid ISBN-10, a valid ISBN-13 or both.
99
1010+----------------+----------------------------------------------------------------------+
1111| Applies to | :ref: `property or method<validation-property-target> ` |
1212+----------------+----------------------------------------------------------------------+
13- | Options | - `isbn10Message `_ |
13+ | Options | - `isbn10 `_ |
14+ | | - `isbn13 `_ |
15+ | | - `isbn10Message `_ |
1416| | - `isbn13Message `_ |
1517| | - `bothIsbnMessage `_ |
16- | | - `isbn10 `_ |
17- | | - `isbn13 `_ |
1818+----------------+----------------------------------------------------------------------+
1919| Class | :class: `Symfony\\ Component\\ Validator\\ Constraints\\ Isbn ` |
2020+----------------+----------------------------------------------------------------------+
@@ -40,19 +40,6 @@ on an object that will contain a ISBN number.
4040 isbn13 : true
4141 bothIsbnMessage : This value is neither a valid ISBN-10 nor a valid ISBN-13.
4242
43- .. code-block :: xml
44-
45- <!-- src/Acme/BookcaseBunlde/Resources/config/validation.xml -->
46- <class name =" Acme\BookcaseBunlde\Entity\Book" >
47- <property name =" isbn" >
48- <constraint name =" Isbn" >
49- <option name =" isbn10" >true</option >
50- <option name =" isbn13" >true</option >
51- <option name =" bothIsbnMessage" >This value is neither a valid ISBN-10 nor a valid ISBN-13.</option >
52- </constraint >
53- </property >
54- </class >
55-
5643 .. code-block :: php-annotations
5744
5845 // src/Acme/BookcaseBunlde/Entity/Book.php
@@ -70,6 +57,19 @@ on an object that will contain a ISBN number.
7057 protected $isbn;
7158 }
7259
60+ .. code-block :: xml
61+
62+ <!-- src/Acme/BookcaseBunlde/Resources/config/validation.xml -->
63+ <class name =" Acme\BookcaseBunlde\Entity\Book" >
64+ <property name =" isbn" >
65+ <constraint name =" Isbn" >
66+ <option name =" isbn10" >true</option >
67+ <option name =" isbn13" >true</option >
68+ <option name =" bothIsbnMessage" >This value is neither a valid ISBN-10 nor a valid ISBN-13.</option >
69+ </constraint >
70+ </property >
71+ </class >
72+
7373 .. code-block :: php
7474
7575 // src/Acme/BookcaseBunlde/Entity/Book.php
@@ -95,42 +95,42 @@ on an object that will contain a ISBN number.
9595 Available Options
9696-----------------
9797
98+ isbn10
99+ ~~~~~~
100+
101+ **type **: ``boolean `` [:ref: `default option<validation-default-option> `]
102+
103+ If this required option is set to ``true `` the constraint will check if the
104+ code is a valid ISBN-10 code.
105+
106+ isbn13
107+ ~~~~~~
108+
109+ **type **: ``boolean `` [:ref: `default option<validation-default-option> `]
110+
111+ If this required option is set to ``true `` the constraint will check if the
112+ code is a valid ISBN-13 code.
113+
98114isbn10Message
99115~~~~~~~~~~~~~
100116
101117**type **: ``string `` **default **: ``This value is not a valid ISBN-10. ``
102118
103- The message that will be shown if the option isbn10 is true
104- and the given value does not pass the ISBN-10 check.
119+ The message that will be shown if the ` isbn10 `_ option is true and the given
120+ value does not pass the ISBN-10 check.
105121
106122isbn13Message
107123~~~~~~~~~~~~~
108124
109125**type **: ``string `` **default **: ``This value is not a valid ISBN-13. ``
110126
111- The message that will be shown if the option isbn13 is true
112- and the given value does not pass the ISBN-13 check.
127+ The message that will be shown if the ` isbn13 `_ option is true and the given
128+ value does not pass the ISBN-13 check.
113129
114130bothIsbnMessage
115131~~~~~~~~~~~~~~~
116132
117133**type **: ``string `` **default **: ``This value is neither a valid ISBN-10 nor a valid ISBN-13. ``
118134
119- The message that will be shown if the options (isbn10, isbn13) is true
120- and the given value does not pass the ISBN-13 nor ISBN-13 check.
121-
122- isbn10
123- ~~~~~~
124-
125- **type **: ``boolean `` [:ref: `default option<validation-default-option> `]
126-
127- If this required option is set to ``true `` the constraint will check
128- if the code is a valid ISBN-10 code.
129-
130- isbn13
131- ~~~~~~
132-
133- **type **: ``boolean `` [:ref: `default option<validation-default-option> `]
134-
135- If this required option is set to ``true `` the constraint will check
136- if the code is a valid ISBN-13 code.
135+ The message that will be shown if both the `isbn10 `_ and `isbn13 `_ options
136+ are true and the given value does not pass the ISBN-13 nor the ISBN-13 check.
0 commit comments