1
1
Isbn
2
2
====
3
3
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.
6
6
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.
9
9
10
10
+----------------+----------------------------------------------------------------------+
11
11
| Applies to | :ref: `property or method<validation-property-target> ` |
12
12
+----------------+----------------------------------------------------------------------+
13
- | Options | - `isbn10Message `_ |
13
+ | Options | - `isbn10 `_ |
14
+ | | - `isbn13 `_ |
15
+ | | - `isbn10Message `_ |
14
16
| | - `isbn13Message `_ |
15
17
| | - `bothIsbnMessage `_ |
16
- | | - `isbn10 `_ |
17
- | | - `isbn13 `_ |
18
18
+----------------+----------------------------------------------------------------------+
19
19
| Class | :class: `Symfony\\ Component\\ Validator\\ Constraints\\ Isbn ` |
20
20
+----------------+----------------------------------------------------------------------+
@@ -40,19 +40,6 @@ on an object that will contain a ISBN number.
40
40
isbn13 : true
41
41
bothIsbnMessage : This value is neither a valid ISBN-10 nor a valid ISBN-13.
42
42
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
-
56
43
.. code-block :: php-annotations
57
44
58
45
// src/Acme/BookcaseBunlde/Entity/Book.php
@@ -70,6 +57,19 @@ on an object that will contain a ISBN number.
70
57
protected $isbn;
71
58
}
72
59
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
+
73
73
.. code-block :: php
74
74
75
75
// src/Acme/BookcaseBunlde/Entity/Book.php
@@ -95,42 +95,42 @@ on an object that will contain a ISBN number.
95
95
Available Options
96
96
-----------------
97
97
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
+
98
114
isbn10Message
99
115
~~~~~~~~~~~~~
100
116
101
117
**type **: ``string `` **default **: ``This value is not a valid ISBN-10. ``
102
118
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.
105
121
106
122
isbn13Message
107
123
~~~~~~~~~~~~~
108
124
109
125
**type **: ``string `` **default **: ``This value is not a valid ISBN-13. ``
110
126
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.
113
129
114
130
bothIsbnMessage
115
131
~~~~~~~~~~~~~~~
116
132
117
133
**type **: ``string `` **default **: ``This value is neither a valid ISBN-10 nor a valid ISBN-13. ``
118
134
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