File tree 1 file changed +7
-3
lines changed
1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -54,6 +54,8 @@ on an object that will contain a credit card number.
54
54
.. code-block :: php-annotations
55
55
56
56
// src/Acme/SubscriptionBundle/Entity/Transaction.php
57
+ namespace Acme\SubscriptionBundle\Entity\Transaction;
58
+
57
59
use Symfony\Component\Validator\Constraints as Assert;
58
60
59
61
class Transaction
@@ -67,16 +69,18 @@ on an object that will contain a credit card number.
67
69
.. code-block :: php
68
70
69
71
// src/Acme/SubscriptionBundle/Entity/Transaction.php
72
+ namespace Acme\SubscriptionBundle\Entity\Transaction;
73
+
70
74
use Symfony\Component\Validator\Mapping\ClassMetadata;
71
- use Symfony\Component\Validator\Constraints\CardScheme ;
75
+ use Symfony\Component\Validator\Constraints as Assert ;
72
76
73
77
class Transaction
74
78
{
75
79
protected $cardNumber;
76
80
77
81
public static function loadValidatorMetadata(ClassMetadata $metadata)
78
82
{
79
- $metadata->addPropertyConstraint('cardSchema ', new CardScheme(array(
83
+ $metadata->addPropertyConstraint('cardNumber ', new Assert\ CardScheme(array(
80
84
'schemes' => array(
81
85
'VISA'
82
86
),
@@ -117,4 +121,4 @@ message
117
121
118
122
The message shown when the value does not pass the ``CardScheme `` check.
119
123
120
- .. _`Wikipedia: Issuer identification number (IIN)` : http://en.wikipedia.org/wiki/Bank_card_number#Issuer_identification_number_.28IIN.29
124
+ .. _`Wikipedia: Issuer identification number (IIN)` : http://en.wikipedia.org/wiki/Bank_card_number#Issuer_identification_number_.28IIN.29
You can’t perform that action at this time.
0 commit comments