From 238e2014ad9061d26482154d9d9080376ebb413b Mon Sep 17 00:00:00 2001 From: Michael Hirschler Date: Wed, 12 Aug 2015 16:30:17 +0200 Subject: [PATCH 1/9] [Validator] added BIC validator --- reference/constraints/Bic.rst | 107 ++++++++++++++++++++++++++++++++++ 1 file changed, 107 insertions(+) create mode 100644 reference/constraints/Bic.rst diff --git a/reference/constraints/Bic.rst b/reference/constraints/Bic.rst new file mode 100644 index 00000000000..f35f8eee29e --- /dev/null +++ b/reference/constraints/Bic.rst @@ -0,0 +1,107 @@ +Bic +=== + +.. versionadded:: 2.8 + The Bic constraint was introduced in Symfony 2.8. + +This constraint is used to ensure that a value has the proper format of an +`Business Identifier Code (BIC)`. BIC is an internationally agreed means to +uniquely identify both financial and non-financiel institutions. + ++----------------+-----------------------------------------------------------------------+ +| Applies to | :ref:`property or method` | ++----------------+-----------------------------------------------------------------------+ +| Options | - `message`_ | +| | - `payload`_ | ++----------------+-----------------------------------------------------------------------+ +| Class | :class:`Symfony\\Component\\Validator\\Constraints\\Bic` | ++----------------+-----------------------------------------------------------------------+ +| Validator | :class:`Symfony\\Component\\Validator\\Constraints\\BicValidator` | ++----------------+-----------------------------------------------------------------------+ + +Basic Usage +----------- + +To use the Bic validator, simply apply it to a property on an object that +will contain a Business Identifier Code. + +.. configuration-block:: + + .. code-block:: php-annotations + + // src/Acme/SubscriptionBundle/Entity/Transaction.php + namespace Acme\SubscriptionBundle\Entity; + + use Symfony\Component\Validator\Constraints as Assert; + + class Transaction + { + /** + * @Assert\Bic( + * message="This is not a valid Business Identifier Code (BIC)." + * ) + */ + protected $businessIdentifierCode; + } + + .. code-block:: yaml + + # src/Acme/SubscriptionBundle/Resources/config/validation.yml + Acme\SubscriptionBundle\Entity\Transaction: + properties: + businessIdentifierCode: + - Bic: + message: This is not a valid Business Identifier Code (BIC). + + .. code-block:: xml + + + + + + + + + + + + + + + .. code-block:: php + + // src/Acme/SubscriptionBundle/Entity/Transaction.php + namespace Acme\SubscriptionBundle\Entity; + + use Symfony\Component\Validator\Mapping\ClassMetadata; + use Symfony\Component\Validator\Constraints as Assert; + + class Transaction + { + protected $businessIdentifierCode; + + public static function loadValidatorMetadata(ClassMetadata $metadata) + { + $metadata->addPropertyConstraint('businessIdentifierCode', new Assert\Bic(array( + 'message' => 'This is not a valid Business Identifier Code (BIC).', + ))); + } + } + +Available Options +----------------- + +message +~~~~~~~ + +**type**: ``string`` **default**: ``This is not a valid Business Identifier Code (BIC).`` + +The default message supplied when the value does not pass the Bic check. + +.. include:: /reference/constraints/_payload-option.rst.inc + +.. _`Business Identifier Code (BIC)`: https://en.wikipedia.org/wiki/Business_Identifier_Code From 8b04d1b92530c81e5e3f9a790d206047f3de1e2c Mon Sep 17 00:00:00 2001 From: Michael Hirschler Date: Wed, 12 Aug 2015 16:54:10 +0200 Subject: [PATCH 2/9] [Validator] fixed typo in description. refs #5623 --- reference/constraints/Bic.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reference/constraints/Bic.rst b/reference/constraints/Bic.rst index f35f8eee29e..6591a712e4e 100644 --- a/reference/constraints/Bic.rst +++ b/reference/constraints/Bic.rst @@ -6,7 +6,7 @@ Bic This constraint is used to ensure that a value has the proper format of an `Business Identifier Code (BIC)`. BIC is an internationally agreed means to -uniquely identify both financial and non-financiel institutions. +uniquely identify both financial and non-financial institutions. +----------------+-----------------------------------------------------------------------+ | Applies to | :ref:`property or method` | From 6726882c0ce2ba1c671f820136cb6b12ef55cabe Mon Sep 17 00:00:00 2001 From: Michael Hirschler Date: Wed, 12 Aug 2015 16:56:41 +0200 Subject: [PATCH 3/9] [Validator] added BIC to constraints index. refs #5623 --- reference/constraints.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/reference/constraints.rst b/reference/constraints.rst index 94077dd3052..56a9651fb2a 100644 --- a/reference/constraints.rst +++ b/reference/constraints.rst @@ -52,6 +52,7 @@ Validation Constraints Reference constraints/Iban constraints/Isbn constraints/Issn + constraints/Bic constraints/Callback constraints/Expression From 51126fa26ba5ccbe8017c5e541cf05a062f34896 Mon Sep 17 00:00:00 2001 From: Michael Hirschler Date: Thu, 13 Aug 2015 08:28:45 +0200 Subject: [PATCH 4/9] [Validator] move bic to iban on index. refs #5623 --- reference/constraints.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reference/constraints.rst b/reference/constraints.rst index 56a9651fb2a..6e31e80788a 100644 --- a/reference/constraints.rst +++ b/reference/constraints.rst @@ -50,9 +50,9 @@ Validation Constraints Reference constraints/Currency constraints/Luhn constraints/Iban + constraints/Bic constraints/Isbn constraints/Issn - constraints/Bic constraints/Callback constraints/Expression From b69f48dbce2d897dd63149114cdcc31f377905a5 Mon Sep 17 00:00:00 2001 From: Michael Hirschler Date: Fri, 14 Aug 2015 15:24:15 +0200 Subject: [PATCH 5/9] [Validator] fixed typos according to notes. refs #5623 --- reference/constraints/Bic.rst | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/reference/constraints/Bic.rst b/reference/constraints/Bic.rst index 6591a712e4e..bf52adb4856 100644 --- a/reference/constraints/Bic.rst +++ b/reference/constraints/Bic.rst @@ -5,7 +5,7 @@ Bic The Bic constraint was introduced in Symfony 2.8. This constraint is used to ensure that a value has the proper format of an -`Business Identifier Code (BIC)`. BIC is an internationally agreed means to +`Business Identifier Code (BIC)`_. BIC is an internationally agreed means to uniquely identify both financial and non-financial institutions. +----------------+-----------------------------------------------------------------------+ @@ -23,14 +23,14 @@ Basic Usage ----------- To use the Bic validator, simply apply it to a property on an object that -will contain a Business Identifier Code. +will contain a Business Identifier Code (BIC). .. configuration-block:: .. code-block:: php-annotations - // src/Acme/SubscriptionBundle/Entity/Transaction.php - namespace Acme\SubscriptionBundle\Entity; + // src/Acme/AppBundle/Entity/Transaction.php + namespace Acme\AppBundle\Entity; use Symfony\Component\Validator\Constraints as Assert; @@ -46,8 +46,8 @@ will contain a Business Identifier Code. .. code-block:: yaml - # src/Acme/SubscriptionBundle/Resources/config/validation.yml - Acme\SubscriptionBundle\Entity\Transaction: + # src/Acme/AppBundle/Resources/config/validation.yml + Acme\AppBundle\Entity\Transaction: properties: businessIdentifierCode: - Bic: @@ -55,13 +55,13 @@ will contain a Business Identifier Code. .. code-block:: xml - + - +