Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit0966024

Browse files
committed
Merge remote-tracking branch 'origin/2.2' into 2.2
2 parents8f07c86 +075c8f5 commit0966024

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

‎reference/constraints/CardScheme.rst‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ on an object that will contain a credit card number.
5454
..code-block::php-annotations
5555
5656
// src/Acme/SubscriptionBundle/Entity/Transaction.php
57+
namespace Acme\SubscriptionBundle\Entity\Transaction;
58+
5759
use Symfony\Component\Validator\Constraints as Assert;
5860
5961
class Transaction
@@ -67,16 +69,18 @@ on an object that will contain a credit card number.
6769
..code-block::php
6870
6971
// src/Acme/SubscriptionBundle/Entity/Transaction.php
72+
namespace Acme\SubscriptionBundle\Entity\Transaction;
73+
7074
use Symfony\Component\Validator\Mapping\ClassMetadata;
71-
use Symfony\Component\Validator\Constraints\CardScheme;
75+
use Symfony\Component\Validator\Constraints as Assert;
7276
7377
class Transaction
7478
{
7579
protected $cardNumber;
7680
7781
public static function loadValidatorMetadata(ClassMetadata $metadata)
7882
{
79-
$metadata->addPropertyConstraint('cardSchema', new CardScheme(array(
83+
$metadata->addPropertyConstraint('cardNumber', newAssert\CardScheme(array(
8084
'schemes' => array(
8185
'VISA'
8286
),
@@ -117,4 +121,4 @@ message
117121

118122
The message shown when the value does not pass the ``CardScheme`` check.
119123

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

‎reference/constraints/Luhn.rst‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Luhn
2-
======
2+
====
33

44
..versionadded::2.2
55
The Luhn validation is new in Symfony 2.2.
@@ -49,6 +49,8 @@ will contain a credit card number.
4949
..code-block::php-annotations
5050
5151
// src/Acme/SubscriptionBundle/Entity/Transaction.php
52+
namespace Acme\SubscriptionBundle\Entity\Transaction;
53+
5254
use Symfony\Component\Validator\Constraints as Assert;
5355
5456
class Transaction
@@ -62,16 +64,18 @@ will contain a credit card number.
6264
..code-block::php
6365
6466
// src/Acme/SubscriptionBundle/Entity/Transaction.php
67+
namespace Acme\SubscriptionBundle\Entity\Transaction;
68+
6569
use Symfony\Component\Validator\Mapping\ClassMetadata;
66-
use Symfony\Component\Validator\Constraints\Luhn;
70+
use Symfony\Component\Validator\Constraints as Assert;
6771
6872
class Transaction
6973
{
7074
protected $cardNumber;
7175
7276
public static function loadValidatorMetadata(ClassMetadata $metadata)
7377
{
74-
$metadata->addPropertyConstraint('luhn', new Luhn(array(
78+
$metadata->addPropertyConstraint('cardNumber', newAssert\Luhn(array(
7579
'message' => 'Please check your credit card number',
7680
)));
7781
}
@@ -87,4 +91,4 @@ message
8791

8892
The default message supplied when the value does not pass the Luhn check.
8993

90-
.. _`Luhn algorithm`:http://en.wikipedia.org/wiki/Luhn_algorithm
94+
.. _`Luhn algorithm`:http://en.wikipedia.org/wiki/Luhn_algorithm

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp