Skip to content

Commit 73f1d51

Browse files
committed
Merge branch '2.8' into 3.0
* 2.8: [#6597] some tweaks [Validator] Add shorter examples using the default option Typo fix Add missing parameter Updated the CS rule about return null; and return; [#6690] fix syntax error Update date.rst - Fixes typo [#6690] add versionadded directive Added an example for a different method of verbosity level usage. NullOutput should be passed to $command->run() Hard values for the driver option Fix ldap security examples
2 parents 9008a37 + 9a8b380 commit 73f1d51

File tree

18 files changed

+197
-37
lines changed

18 files changed

+197
-37
lines changed

book/doctrine.rst

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ information. By convention, this information is usually configured in an
4343
4444
# app/config/parameters.yml
4545
parameters:
46-
database_driver: pdo_mysql
4746
database_host: localhost
4847
database_name: test_project
4948
database_user: root
@@ -64,7 +63,7 @@ information. By convention, this information is usually configured in an
6463
# app/config/config.yml
6564
doctrine:
6665
dbal:
67-
driver: '%database_driver%'
66+
driver: pdo_mysql
6867
host: '%database_host%'
6968
dbname: '%database_name%'
7069
user: '%database_user%'
@@ -84,7 +83,7 @@ information. By convention, this information is usually configured in an
8483
8584
<doctrine:config>
8685
<doctrine:dbal
87-
driver="%database_driver%"
86+
driver="pdo_mysql"
8887
host="%database_host%"
8988
dbname="%database_name%"
9089
user="%database_user%"
@@ -97,7 +96,7 @@ information. By convention, this information is usually configured in an
9796
// app/config/config.php
9897
$configuration->loadFromExtension('doctrine', array(
9998
'dbal' => array(
100-
'driver' => '%database_driver%',
99+
'driver' => 'pdo_mysql',
101100
'host' => '%database_host%',
102101
'dbname' => '%database_name%',
103102
'user' => '%database_user%',

components/console/introduction.rst

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,13 @@ level. For example::
225225
$output->writeln(...);
226226
}
227227

228+
// alternatively you can pass the verbosity level to writeln()
229+
$output->writeln('...', OutputInterface::VERBOSITY_VERBOSE);
230+
231+
.. versionadded:: 2.8
232+
The ability to pass the verbosity level to the ``writeln()`` method was
233+
introduced in Symfony 2.8.
234+
228235
There are also more semantic methods you can use to test for each of the
229236
verbosity levels::
230237

@@ -548,7 +555,7 @@ returns the returned code from the command (return value from command's
548555

549556
If you want to suppress the output of the executed command, pass a
550557
:class:`Symfony\\Component\\Console\\Output\\NullOutput` as the second
551-
argument to ``$command->execute()``.
558+
argument to ``$command->run()``.
552559

553560
.. caution::
554561

contributing/code/standards.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ example containing most features described below:
9191
);
9292

9393
if (true === $dummy) {
94-
return;
94+
return null;
9595
}
9696

9797
if ('string' === $dummy) {
@@ -109,7 +109,7 @@ example containing most features described below:
109109
* @param mixed $value Some value to check against
110110
* @param bool $theSwitch Some switch to control the method's flow
111111
*
112-
* @return bool|null The resultant check if $theSwitch isn't false, null otherwise
112+
* @return bool|void The resultant check if $theSwitch isn't false, void otherwise
113113
*/
114114
private function reverseBoolean($value = null, $theSwitch = false)
115115
{
@@ -143,8 +143,8 @@ Structure
143143
* Add a blank line before ``return`` statements, unless the return is alone
144144
inside a statement-group (like an ``if`` statement);
145145

146-
* Use just ``return;`` instead of ``return null;`` when a function must return
147-
void early;
146+
* Use ``return null;`` when a function explicitly returns ``null`` values and
147+
use ``return;`` when the function returns ``void`` values;
148148

149149
* Use braces to indicate control structure body regardless of the number of
150150
statements it contains;

cookbook/configuration/micro-kernel-trait.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ to hold the kernel. Now it looks like this::
195195
// load the annotation routes
196196
$routes->mount(
197197
'/',
198-
$routes->import(__DIR__.'/../src/App/Controller/', 'annotation')
198+
$routes->import(__DIR__.'/../src/App/Controller/', '/', 'annotation')
199199
);
200200
}
201201
}

cookbook/doctrine/multiple_entity_managers.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,15 @@ The following configuration code shows how you can configure two entity managers
2727
default_connection: default
2828
connections:
2929
default:
30-
driver: '%database_driver%'
30+
driver: pdo_mysql
3131
host: '%database_host%'
3232
port: '%database_port%'
3333
dbname: '%database_name%'
3434
user: '%database_user%'
3535
password: '%database_password%'
3636
charset: UTF8
3737
customer:
38-
driver: '%database_driver2%'
38+
driver: pdo_mysql
3939
host: '%database_host2%'
4040
port: '%database_port2%'
4141
dbname: '%database_name2%'
@@ -68,7 +68,7 @@ The following configuration code shows how you can configure two entity managers
6868
<config>
6969
<dbal default-connection="default">
7070
<connection name="default"
71-
driver="%database_driver%"
71+
driver="pdo_mysql"
7272
host="%database_host%"
7373
port="%database_port%"
7474
dbname="%database_name%"
@@ -78,7 +78,7 @@ The following configuration code shows how you can configure two entity managers
7878
/>
7979
8080
<connection name="customer"
81-
driver="%database_driver2%"
81+
driver="pdo_mysql"
8282
host="%database_host2%"
8383
port="%database_port2%"
8484
dbname="%database_name2%"
@@ -108,7 +108,7 @@ The following configuration code shows how you can configure two entity managers
108108
'default_connection' => 'default',
109109
'connections' => array(
110110
'default' => array(
111-
'driver' => '%database_driver%',
111+
'driver' => 'pdo_mysql',
112112
'host' => '%database_host%',
113113
'port' => '%database_port%',
114114
'dbname' => '%database_name%',
@@ -117,7 +117,7 @@ The following configuration code shows how you can configure two entity managers
117117
'charset' => 'UTF8',
118118
),
119119
'customer' => array(
120-
'driver' => '%database_driver2%',
120+
'driver' => 'pdo_mysql',
121121
'host' => '%database_host2%',
122122
'port' => '%database_port2%',
123123
'dbname' => '%database_name2%',

cookbook/security/ldap.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ Configuration example for form login
287287
# ...
288288
form_login_ldap:
289289
login_path: login
290-
login_check: login_check
290+
check_path: login_check
291291
# ...
292292
service: ldap
293293
dn_string: 'uid={username},dc=example,dc=com'
@@ -306,7 +306,7 @@ Configuration example for form login
306306
<firewall name="main">
307307
<form-login-ldap
308308
login-path="login"
309-
login-check="login_check"
309+
check-path="login_check"
310310
service="ldap"
311311
dn-string="uid={username},dc=example,dc=com" />
312312
</firewall>
@@ -320,7 +320,7 @@ Configuration example for form login
320320
'main' => array(
321321
'form_login_ldap' => array(
322322
'login_path' => 'login',
323-
'login_check' => 'login_check',
323+
'check_path' => 'login_check',
324324
'service' => 'ldap',
325325
'dn_string' => 'uid={username},dc=example,dc=com',
326326
// ...

cookbook/session/php_bridge.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ If you're integrating the Symfony full-stack Framework into a legacy application
88
that starts the session with ``session_start()``, you may still be able to
99
use Symfony's session management by using the PHP Bridge session.
1010

11-
If the application has sets it's own PHP save handler, you can specify null
11+
If the application has it's own PHP save handler, you can specify null
1212
for the ``handler_id``:
1313

1414
.. configuration-block::

reference/constraints/Choice.rst

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,11 @@ If your valid choice list is simple, you can pass them in directly via the
4646
4747
class Author
4848
{
49+
/**
50+
* @Assert\Choice({"New York", "Berlin", "Tokyo"})
51+
*/
52+
protected $city;
53+
4954
/**
5055
* @Assert\Choice(choices = {"male", "female"}, message = "Choose a valid gender.")
5156
*/
@@ -57,6 +62,7 @@ If your valid choice list is simple, you can pass them in directly via the
5762
# src/AppBundle/Resources/config/validation.yml
5863
AppBundle\Entity\Author:
5964
properties:
65+
city: [New York, Berlin, Tokyo]
6066
gender:
6167
- Choice:
6268
choices: [male, female]
@@ -71,6 +77,13 @@ If your valid choice list is simple, you can pass them in directly via the
7177
xsi:schemaLocation="http://symfony.com/schema/dic/constraint-mapping http://symfony.com/schema/dic/constraint-mapping/constraint-mapping-1.0.xsd">
7278
7379
<class name="AppBundle\Entity\Author">
80+
<property name="city">
81+
<constraint name="Choice">
82+
<value>New York</value>
83+
<value>Berlin</value>
84+
<value>Tokyo</value>
85+
</constraint>
86+
</property>
7487
<property name="gender">
7588
<constraint name="Choice">
7689
<option name="choices">
@@ -97,6 +110,11 @@ If your valid choice list is simple, you can pass them in directly via the
97110
98111
public static function loadValidatorMetadata(ClassMetadata $metadata)
99112
{
113+
$metadata->addPropertyConstraint(
114+
'gender',
115+
new Assert\Choice(array('New York', 'Berlin', 'Tokyo'))
116+
);
117+
100118
$metadata->addPropertyConstraint('gender', new Assert\Choice(array(
101119
'choices' => array('male', 'female'),
102120
'message' => 'Choose a valid gender.',

reference/constraints/EqualTo.rst

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ To force that a value is *not* equal, see :doc:`/reference/constraints/NotEqualT
2525
Basic Usage
2626
-----------
2727

28-
If you want to ensure that the ``age`` of a ``Person`` class is equal to
29-
``20``, you could do the following:
28+
If you want to ensure that the ``firstName`` of a ``Person`` class is equal to ``Mary``
29+
and that the ``age`` is ``20``, you could do the following:
3030

3131
.. configuration-block::
3232

@@ -39,6 +39,11 @@ If you want to ensure that the ``age`` of a ``Person`` class is equal to
3939
4040
class Person
4141
{
42+
/**
43+
* @Assert\EqualTo("Mary")
44+
*/
45+
protected $firstName;
46+
4247
/**
4348
* @Assert\EqualTo(
4449
* value = 20
@@ -52,6 +57,8 @@ If you want to ensure that the ``age`` of a ``Person`` class is equal to
5257
# src/AppBundle/Resources/config/validation.yml
5358
AppBundle\Entity\Person:
5459
properties:
60+
firstName:
61+
- EqualTo: Mary
5562
age:
5663
- EqualTo:
5764
value: 20
@@ -65,6 +72,11 @@ If you want to ensure that the ``age`` of a ``Person`` class is equal to
6572
xsi:schemaLocation="http://symfony.com/schema/dic/constraint-mapping http://symfony.com/schema/dic/constraint-mapping/constraint-mapping-1.0.xsd">
6673
6774
<class name="AppBundle\Entity\Person">
75+
<property name="firstName">
76+
<constraint name="EqualTo">
77+
<value>Mary</value>
78+
</constraint>
79+
</property>
6880
<property name="age">
6981
<constraint name="EqualTo">
7082
<option name="value">20</option>
@@ -85,6 +97,8 @@ If you want to ensure that the ``age`` of a ``Person`` class is equal to
8597
{
8698
public static function loadValidatorMetadata(ClassMetadata $metadata)
8799
{
100+
$metadata->addPropertyConstraint('firstName', new Assert\EqualTo('Mary'));
101+
88102
$metadata->addPropertyConstraint('age', new Assert\EqualTo(array(
89103
'value' => 20,
90104
)));

reference/constraints/GreaterThan.rst

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,10 @@ than another value, see :doc:`/reference/constraints/LessThan`.
2121
Basic Usage
2222
-----------
2323

24-
If you want to ensure that the ``age`` of a ``Person`` class is greater than
25-
``18``, you could do the following:
24+
The following constraints ensure that:
25+
26+
* the number of ``siblings`` of a ``Person`` is greater than ``5``
27+
* the ``age`` of a ``Person`` class is greater than ``18``
2628

2729
.. configuration-block::
2830

@@ -35,6 +37,12 @@ If you want to ensure that the ``age`` of a ``Person`` class is greater than
3537
3638
class Person
3739
{
40+
41+
/**
42+
* @Assert\GreaterThan(5)
43+
*/
44+
protected $siblings;
45+
3846
/**
3947
* @Assert\GreaterThan(
4048
* value = 18
@@ -48,6 +56,8 @@ If you want to ensure that the ``age`` of a ``Person`` class is greater than
4856
# src/AppBundle/Resources/config/validation.yml
4957
AppBundle\Entity\Person:
5058
properties:
59+
siblings:
60+
- GreaterThan: 5
5161
age:
5262
- GreaterThan:
5363
value: 18
@@ -61,6 +71,11 @@ If you want to ensure that the ``age`` of a ``Person`` class is greater than
6171
xsi:schemaLocation="http://symfony.com/schema/dic/constraint-mapping http://symfony.com/schema/dic/constraint-mapping/constraint-mapping-1.0.xsd">
6272
6373
<class name="AppBundle\Entity\Person">
74+
<property name="siblings">
75+
<constraint name="GreaterThan">
76+
<value>5</value>
77+
</constraint>
78+
</property>
6479
<property name="age">
6580
<constraint name="GreaterThan">
6681
<option name="value">18</option>
@@ -81,6 +96,8 @@ If you want to ensure that the ``age`` of a ``Person`` class is greater than
8196
{
8297
public static function loadValidatorMetadata(ClassMetadata $metadata)
8398
{
99+
$metadata->addPropertyConstraint('siblings', new Assert\GreaterThan(5));
100+
84101
$metadata->addPropertyConstraint('age', new Assert\GreaterThan(array(
85102
'value' => 18,
86103
)));

reference/constraints/GreaterThanOrEqual.rst

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,10 @@ the options. To force that a value is greater than another value, see
2020
Basic Usage
2121
-----------
2222

23-
If you want to ensure that the ``age`` of a ``Person`` class is greater than
24-
or equal to ``18``, you could do the following:
23+
The following constraints ensure that:
24+
25+
* the number of ``siblings`` of a ``Person`` is greater than or equal to ``5``
26+
* the ``age`` of a ``Person`` class is greater than or equal to ``18``
2527

2628
.. configuration-block::
2729

@@ -34,6 +36,11 @@ or equal to ``18``, you could do the following:
3436
3537
class Person
3638
{
39+
/**
40+
* @Assert\GreaterThanOrEqual(5)
41+
*/
42+
protected $siblings;
43+
3744
/**
3845
* @Assert\GreaterThanOrEqual(
3946
* value = 18
@@ -47,6 +54,8 @@ or equal to ``18``, you could do the following:
4754
# src/AppBundle/Resources/config/validation.yml
4855
AppBundle\Entity\Person:
4956
properties:
57+
siblings:
58+
- GreaterThanOrEqual: 5
5059
age:
5160
- GreaterThanOrEqual:
5261
value: 18
@@ -60,6 +69,11 @@ or equal to ``18``, you could do the following:
6069
xsi:schemaLocation="http://symfony.com/schema/dic/constraint-mapping http://symfony.com/schema/dic/constraint-mapping/constraint-mapping-1.0.xsd">
6170
6271
<class name="AppBundle\Entity\Person">
72+
<property name="siblings">
73+
<constraint name="GreaterThanOrEqual">
74+
<value>5</value>
75+
</constraint>
76+
</property>
6377
<property name="age">
6478
<constraint name="GreaterThanOrEqual">
6579
<option name="value">18</option>
@@ -80,6 +94,8 @@ or equal to ``18``, you could do the following:
8094
{
8195
public static function loadValidatorMetadata(ClassMetadata $metadata)
8296
{
97+
$metadata->addPropertyConstraint('siblings', new Assert\GreaterThanOrEqual(5));
98+
8399
$metadata->addPropertyConstraint('age', new Assert\GreaterThanOrEqual(array(
84100
'value' => 18,
85101
)));

0 commit comments

Comments
 (0)