Skip to content

Commit df73214

Browse files
committed
Merge branch '3.0' into 3.1
2 parents 9363cd3 + c4ebee2 commit df73214

File tree

11 files changed

+84
-52
lines changed

11 files changed

+84
-52
lines changed

components/console/introduction.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ Coloring the Output
143143
By default, the Windows command console doesn't support output coloring. The
144144
Console component disables output coloring for Windows systems, but if your
145145
commands invoke other scripts which emit color sequences, they will be
146-
wrongly displayed as raw escape characters. Install the `ConEmu`_, `ANSICON`_
146+
wrongly displayed as raw escape characters. Install the `Cmder`_, `ConEmu`_, `ANSICON`_
147147
or `Mintty`_ (used by default in GitBash and Cygwin) free applications
148148
to add coloring support to your Windows command console.
149149

@@ -577,6 +577,7 @@ Learn More!
577577
* :doc:`/components/console/console_arguments`
578578

579579
.. _Packagist: https://packagist.org/packages/symfony/console
580+
.. _Cmder: http://cmder.net/
580581
.. _ConEmu: https://conemu.github.io/
581582
.. _ANSICON: https://github.com/adoxa/ansicon/releases
582583
.. _Mintty: https://mintty.github.io/

components/dependency_injection/autowiring.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ returning the result of the ROT13 transformation uppercased::
250250
}
251251
}
252252

253-
This class is intended to decorate the any transformer and return its value uppercased.
253+
This class is intended to decorate any transformer and return its value uppercased.
254254

255255
We can now refactor the controller to add another endpoint leveraging this new
256256
transformer::

components/dependency_injection/lazy_services.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,9 @@ your lazy loaded services are working.
9797

9898
.. note::
9999

100-
If you don't install the `ProxyManager bridge`_, the container will
101-
just skip over the ``lazy`` flag and simply instantiate the service
102-
as it would normally do.
100+
If you don't install the `ProxyManager bridge`_ and the
101+
`ocramius/proxy-manager`_, the container will just skip over the ``lazy``
102+
flag and simply instantiate the service as it would normally do.
103103

104104
The proxy gets initialized and the actual service is instantiated as soon
105105
as you interact in any way with this object.
@@ -114,3 +114,4 @@ in the `documentation of ProxyManager`_.
114114
.. _`ProxyManager bridge`: https://github.com/symfony/symfony/tree/master/src/Symfony/Bridge/ProxyManager
115115
.. _`proxy`: https://en.wikipedia.org/wiki/Proxy_pattern
116116
.. _`documentation of ProxyManager`: https://github.com/Ocramius/ProxyManager/blob/master/docs/lazy-loading-value-holder.md
117+
.. _`ocramius/proxy-manager`: https://github.com/Ocramius/ProxyManager

contributing/code/tests.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,10 @@ what's going on and if the tests are broken because of the new code.
5151
5252
.. tip::
5353

54-
On Windows, install the `ConEmu`_, `ANSICON`_ or `Mintty`_ free applications
54+
On Windows, install the `Cmder`_, `ConEmu`_, `ANSICON`_ or `Mintty`_ free applications
5555
to see colored test results.
5656

57+
.. _Cmder: http://cmder.net/
5758
.. _ConEmu: https://code.google.com/p/conemu-maximus5/
5859
.. _ANSICON: https://github.com/adoxa/ansicon/releases
5960
.. _Mintty: https://mintty.github.io/

cookbook/bundles/extension.rst

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,3 +125,39 @@ Using Configuration to Change the Services
125125
The Extension is also the class that handles the configuration for that
126126
particular bundle (e.g. the configuration in ``app/config/config.yml``). To
127127
read more about it, see the ":doc:`/cookbook/bundles/configuration`" article.
128+
129+
Adding Classes to Compile
130+
-------------------------
131+
132+
Symfony creates a big ``classes.php`` file in the cache directory to aggregate
133+
the contents of the PHP classes that are used in every request. This reduces the
134+
I/O operations and increases the application performance.
135+
136+
Your bundles can also add their own classes into this file thanks to the
137+
``addClassesToCompile()`` method. Define the classes to compile as an array of
138+
their fully qualified class names::
139+
140+
// ...
141+
public function load(array $configs, ContainerBuilder $container)
142+
{
143+
// ...
144+
145+
$this->addClassesToCompile(array(
146+
'AppBundle\\Manager\\UserManager',
147+
'AppBundle\\Utils\\Slugger',
148+
// ...
149+
));
150+
}
151+
152+
.. note::
153+
154+
If some class extends from other classes, all its parents are automatically
155+
included in the list of classes to compile.
156+
157+
Beware that this technique **can't be used in some cases**:
158+
159+
* When classes contain annotations, such as controllers with ``@Route``
160+
annotations and entities with ``@ORM`` or ``@Assert`` annotations, because
161+
the file location retrieved from PHP reflection changes;
162+
* When classes use the ``__DIR__`` and ``__FILE__`` constants, because their
163+
values will change when loading these classes from the ``classes.php`` file.

cookbook/console/logging.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ First configure a listener for console exception events in the service container
8181
8282
# app/config/services.yml
8383
services:
84-
kernel.listener.command_dispatch:
84+
app.listener.command_exception:
8585
class: AppBundle\EventListener\ConsoleExceptionListener
8686
arguments: ['@logger']
8787
tags:
@@ -96,7 +96,7 @@ First configure a listener for console exception events in the service container
9696
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
9797
9898
<services>
99-
<service id="kernel.listener.command_dispatch" class="AppBundle\EventListener\ConsoleExceptionListener">
99+
<service id="app.listener.command_exception" class="AppBundle\EventListener\ConsoleExceptionListener">
100100
<argument type="service" id="logger"/>
101101
<tag name="kernel.event_listener" event="console.exception" />
102102
</service>
@@ -118,7 +118,7 @@ First configure a listener for console exception events in the service container
118118
array('event' => 'console.exception')
119119
);
120120
$container->setDefinition(
121-
'kernel.listener.command_dispatch',
121+
'app.listener.command_exception',
122122
$definitionConsoleExceptionListener
123123
);
124124
@@ -178,7 +178,7 @@ First configure a listener for console terminate events in the service container
178178
179179
# app/config/services.yml
180180
services:
181-
kernel.listener.command_dispatch:
181+
app.listener.command_error:
182182
class: AppBundle\EventListener\ErrorLoggerListener
183183
arguments: ['@logger']
184184
tags:
@@ -193,7 +193,7 @@ First configure a listener for console terminate events in the service container
193193
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
194194
195195
<services>
196-
<service id="kernel.listener.command_dispatch" class="AppBundle\EventListener\ErrorLoggerListener">
196+
<service id="app.listener.command_error" class="AppBundle\EventListener\ErrorLoggerListener">
197197
<argument type="service" id="logger"/>
198198
<tag name="kernel.event_listener" event="console.terminate" />
199199
</service>
@@ -215,7 +215,7 @@ First configure a listener for console terminate events in the service container
215215
array('event' => 'console.terminate')
216216
);
217217
$container->setDefinition(
218-
'kernel.listener.command_dispatch',
218+
'app.listener.command_error',
219219
$definitionErrorLoggerListener
220220
);
221221

cookbook/console/style.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ Result Methods
300300

301301
:method:`Symfony\\Component\\Console\\Style\\SymfonyStyle::warning`
302302
It displays the given string or array of strings highlighted as a warning
303-
message (with a read background and the ``[WARNING]`` label). It's meant to be
303+
message (with a red background and the ``[WARNING]`` label). It's meant to be
304304
used once to display the final result of executing the given command, but you
305305
can use it repeatedly during the execution of the command::
306306

@@ -317,7 +317,7 @@ Result Methods
317317

318318
:method:`Symfony\\Component\\Console\\Style\\SymfonyStyle::error`
319319
It displays the given string or array of strings highlighted as an error
320-
message (with a read background and the ``[ERROR]`` label). It's meant to be
320+
message (with a red background and the ``[ERROR]`` label). It's meant to be
321321
used once to display the final result of executing the given command, but you
322322
can use it repeatedly during the execution of the command::
323323

cookbook/frontend/bower.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ it's installed correctly.
2525
.. tip::
2626

2727
If you don't want to have NodeJS on your computer, you can also use
28-
BowerPHP_ (an unofficial PHP port of Bower). Beware that this is still in
29-
an alpha state. If you're using BowerPHP, use ``bowerphp`` instead of
28+
BowerPHP_ (an unofficial PHP port of Bower). Beware that this is currently
29+
in beta status. If you're using BowerPHP, use ``bowerphp`` instead of
3030
``bower`` in the examples.
3131

3232
Configuring Bower in your Project

cookbook/profiler/profiling_data.rst

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -34,29 +34,14 @@ The ``profiler`` service also provides the
3434
look for tokens based on some criteria::
3535

3636
// get the latest 10 tokens
37-
$tokens = $container->get('profiler')->find('', '', 10, '', '');
37+
$tokens = $container->get('profiler')->find('', '', 10, '', '', '');
3838

3939
// get the latest 10 tokens for all URL containing /admin/
40-
$tokens = $container->get('profiler')->find('', '/admin/', 10, '', '');
40+
$tokens = $container->get('profiler')->find('', '/admin/', 10, '', '', '');
4141

42-
// get the latest 10 tokens for local requests
43-
$tokens = $container->get('profiler')->find('127.0.0.1', '', 10, '', '');
42+
// get the latest 10 tokens for local POST requests
43+
$tokens = $container->get('profiler')->find('127.0.0.1', '', 10, 'POST', '', '');
4444

4545
// get the latest 10 tokens for requests that happened between 2 and 4 days ago
4646
$tokens = $container->get('profiler')
47-
->find('', '', 10, '4 days ago', '2 days ago');
48-
49-
Lastly, if you want to manipulate profiling data on a different machine than the
50-
one where the information was generated, use the ``profiler:export`` and
51-
``profiler:import`` commands:
52-
53-
.. code-block:: bash
54-
55-
# on the production machine
56-
$ php bin/console profiler:export > profile.data
57-
58-
# on the development machine
59-
$ php bin/console profiler:import /path/to/profile.data
60-
61-
# you can also pipe from the STDIN
62-
$ cat /path/to/profile.data | php bin/console profiler:import
47+
->find('', '', 10, '', '4 days ago', '2 days ago');

cookbook/testing/doctrine.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,5 +62,6 @@ which makes all of this quite easy::
6262
parent::tearDown();
6363

6464
$this->em->close();
65+
$this->em = null; // avoid memory leaks
6566
}
6667
}

reference/forms/types/entity.rst

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -61,25 +61,29 @@ be listed inside the choice field::
6161
// ...
6262

6363
$builder->add('users', EntityType::class, array(
64+
// query choices from this entity
6465
'class' => 'AppBundle:User',
66+
67+
// use the User.username property as the visible option string
6568
'choice_label' => 'username',
69+
70+
// used to render a select box, check boxes or radios
71+
// 'multiple' => true,
72+
// 'expanded' => true,
6673
));
6774

68-
In this case, all ``User`` objects will be loaded from the database and
69-
rendered as either a ``select`` tag, a set or radio buttons or a series
70-
of checkboxes (this depends on the ``multiple`` and ``expanded`` values).
71-
Because of the `choice_label`_ option, the ``username`` property (usually by calling
72-
``getUsername()``) will be used as the text to display in the field.
75+
This will build a ``select`` drop-down containing *all* of the ``User`` objects
76+
in the database. To render radio buttons or checkboxes instead, change the
77+
`multiple`_ and `expanded`_ options.
7378

74-
If you omit the ``choice_label`` option, then your entity *must* have a ``__toString()``
75-
method.
79+
.. _ref-form-entity-query-builder:
7680

7781
Using a Custom Query for the Entities
7882
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
7983

80-
If you need to specify a custom query to use when fetching the entities
84+
If you want to create a custom query to use when fetching the entities
8185
(e.g. you only want to return some entities, or need to order them), use
82-
the ``query_builder`` option. The easiest way to use the option is as follows::
86+
the `query_builder`_ option::
8387

8488
use Doctrine\ORM\EntityRepository;
8589
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
@@ -91,15 +95,17 @@ the ``query_builder`` option. The easiest way to use the option is as follows::
9195
return $er->createQueryBuilder('u')
9296
->orderBy('u.username', 'ASC');
9397
},
98+
'choice_label' => 'username',
9499
));
95100

96101
.. _reference-forms-entity-choices:
97102

98103
Using Choices
99104
~~~~~~~~~~~~~
100105

101-
If you already have the exact collection of entities that you want included
102-
in the choice element, you can simply pass them via the ``choices`` key.
106+
If you already have the exact collection of entities that you want to include
107+
in the choice element, just pass them via the ``choices`` key.
108+
103109
For example, if you have a ``$group`` variable (passed into your form perhaps
104110
as a form option) and ``getUsers`` returns a collection of ``User`` entities,
105111
then you can supply the ``choices`` option directly::
@@ -188,11 +194,12 @@ query_builder
188194

189195
**type**: ``Doctrine\ORM\QueryBuilder`` or a Closure
190196

191-
If specified, this is used to query the subset of options (and their
192-
order) that should be used for the field. The value of this option can
193-
either be a ``QueryBuilder`` object or a Closure. If using a Closure,
194-
it should take a single argument, which is the ``EntityRepository`` of
195-
the entity and return an instance of ``QueryBuilder``.
197+
Allows you to create a custom query for your choices. See
198+
:ref:`ref-form-entity-query-builder` for an example.
199+
200+
The value of this option can either be a ``QueryBuilder`` object or a Closure.
201+
When using a Closure, you will be passed the ``EntityRepository`` of the entity
202+
as the only argument and should return a ``QueryBuilder``.
196203

197204
Overridden Options
198205
------------------

0 commit comments

Comments
 (0)