From e3ed39718e9dfed334611cb0ca5039a0e6e03176 Mon Sep 17 00:00:00 2001 From: Manuel Reinhard Date: Sat, 20 Apr 2013 18:31:12 +0200 Subject: [PATCH] Improved CardScheme validator doc Based on feedback from @WouterJ on the Iban validator doc. See https://github.com/symfony/symfony-docs/pull/2521 --- reference/constraints/CardScheme.rst | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/reference/constraints/CardScheme.rst b/reference/constraints/CardScheme.rst index 35b63aacb02..895a8171991 100644 --- a/reference/constraints/CardScheme.rst +++ b/reference/constraints/CardScheme.rst @@ -54,6 +54,8 @@ on an object that will contain a credit card number. .. code-block:: php-annotations // src/Acme/SubscriptionBundle/Entity/Transaction.php + namespace Acme\SubscriptionBundle\Entity\Transaction; + use Symfony\Component\Validator\Constraints as Assert; class Transaction @@ -67,8 +69,10 @@ on an object that will contain a credit card number. .. code-block:: php // src/Acme/SubscriptionBundle/Entity/Transaction.php + namespace Acme\SubscriptionBundle\Entity\Transaction; + use Symfony\Component\Validator\Mapping\ClassMetadata; - use Symfony\Component\Validator\Constraints\CardScheme; + use Symfony\Component\Validator\Constraints as Assert; class Transaction { @@ -76,7 +80,7 @@ on an object that will contain a credit card number. public static function loadValidatorMetadata(ClassMetadata $metadata) { - $metadata->addPropertyConstraint('cardSchema', new CardScheme(array( + $metadata->addPropertyConstraint('cardNumber', new Assert\CardScheme(array( 'schemes' => array( 'VISA' ), @@ -117,4 +121,4 @@ message The message shown when the value does not pass the ``CardScheme`` check. -.. _`Wikipedia: Issuer identification number (IIN)`: http://en.wikipedia.org/wiki/Bank_card_number#Issuer_identification_number_.28IIN.29 \ No newline at end of file +.. _`Wikipedia: Issuer identification number (IIN)`: http://en.wikipedia.org/wiki/Bank_card_number#Issuer_identification_number_.28IIN.29