Skip to content

Commit b13593e

Browse files
committed
Merge branch '2.8'
2 parents 46096d3 + b03367c commit b13593e

File tree

4 files changed

+102
-2
lines changed

4 files changed

+102
-2
lines changed

Diff for: create_framework/dependency-injection.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,6 @@ micro-framework, and especially its `Application`_ class.
238238

239239
Have fun!
240240

241-
.. _`Pimple`: https://github.com/fabpot/Pimple
241+
.. _`Pimple`: https://github.com/silexphp/Pimple
242242
.. _`Silex`: http://silex.sensiolabs.org/
243-
.. _`Application`: https://github.com/fabpot/Silex/blob/master/src/Silex/Application.php
243+
.. _`Application`: https://github.com/silexphp/Silex/blob/master/src/Silex/Application.php

Diff for: reference/constraints.rst

+1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ Validation Constraints Reference
5050
constraints/Currency
5151
constraints/Luhn
5252
constraints/Iban
53+
constraints/Bic
5354
constraints/Isbn
5455
constraints/Issn
5556

Diff for: reference/constraints/Bic.rst

+98
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
Bic
2+
===
3+
4+
.. versionadded:: 2.8
5+
The Bic constraint was introduced in Symfony 2.8.
6+
7+
This constraint is used to ensure that a value has the proper format of a
8+
`Business Identifier Code (BIC)`_. BIC is an internationally agreed means to
9+
uniquely identify both financial and non-financial institutions.
10+
11+
+----------------+-----------------------------------------------------------------------+
12+
| Applies to | :ref:`property or method <validation-property-target>` |
13+
+----------------+-----------------------------------------------------------------------+
14+
| Options | - `message`_ |
15+
| | - `payload`_ |
16+
+----------------+-----------------------------------------------------------------------+
17+
| Class | :class:`Symfony\\Component\\Validator\\Constraints\\Bic` |
18+
+----------------+-----------------------------------------------------------------------+
19+
| Validator | :class:`Symfony\\Component\\Validator\\Constraints\\BicValidator` |
20+
+----------------+-----------------------------------------------------------------------+
21+
22+
Basic Usage
23+
-----------
24+
25+
To use the Bic validator, simply apply it to a property on an object that
26+
will contain a Business Identifier Code (BIC).
27+
28+
.. configuration-block::
29+
30+
.. code-block:: php-annotations
31+
32+
// src/AppBundle/Entity/Transaction.php
33+
namespace AppBundle\Entity;
34+
35+
use Symfony\Component\Validator\Constraints as Assert;
36+
37+
class Transaction
38+
{
39+
/**
40+
* @Assert\Bic()
41+
*/
42+
protected $businessIdentifierCode;
43+
}
44+
45+
.. code-block:: yaml
46+
47+
# src/AppBundle/Resources/config/validation.yml
48+
AppBundle\Entity\Transaction:
49+
properties:
50+
businessIdentifierCode:
51+
- Bic: ~
52+
53+
.. code-block:: xml
54+
55+
<!-- src/AppBundle/Resources/config/validation.xml -->
56+
<?xml version="1.0" encoding="UTF-8" ?>
57+
<constraint-mapping xmlns="http://symfony.com/schema/dic/constraint-mapping"
58+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
59+
xsi:schemaLocation="http://symfony.com/schema/dic/constraint-mapping http://symfony.com/schema/dic/constraint-mapping/constraint-mapping-1.0.xsd">
60+
61+
<class name="AppBundle\Entity\Transaction">
62+
<property name="businessIdentifierCode">
63+
<constraint name="Bic" />
64+
</property>
65+
</class>
66+
</constraint-mapping>
67+
68+
.. code-block:: php
69+
70+
// src/AppBundle/Entity/Transaction.php
71+
namespace AppBundle\Entity;
72+
73+
use Symfony\Component\Validator\Mapping\ClassMetadata;
74+
use Symfony\Component\Validator\Constraints as Assert;
75+
76+
class Transaction
77+
{
78+
protected $businessIdentifierCode;
79+
80+
public static function loadValidatorMetadata(ClassMetadata $metadata)
81+
{
82+
$metadata->addPropertyConstraint('businessIdentifierCode', new Assert\Bic());
83+
}
84+
}
85+
86+
Available Options
87+
-----------------
88+
89+
message
90+
~~~~~~~
91+
92+
**type**: ``string`` **default**: ``This is not a valid Business Identifier Code (BIC).``
93+
94+
The default message supplied when the value does not pass the BIC check.
95+
96+
.. include:: /reference/constraints/_payload-option.rst.inc
97+
98+
.. _`Business Identifier Code (BIC)`: https://en.wikipedia.org/wiki/Business_Identifier_Code

Diff for: reference/constraints/map.rst.inc

+1
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ File Constraints
6666
Financial and other Number Constraints
6767
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
6868

69+
* :doc:`Bic </reference/constraints/Bic>`
6970
* :doc:`CardScheme </reference/constraints/CardScheme>`
7071
* :doc:`Currency </reference/constraints/Currency>`
7172
* :doc:`Luhn </reference/constraints/Luhn>`

0 commit comments

Comments
 (0)