Skip to content

Commit 6b56422

Browse files
committed
Merge branch '2.4'
2 parents b760612 + 344c1e4 commit 6b56422

File tree

7 files changed

+109
-10
lines changed

7 files changed

+109
-10
lines changed

components/console/helpers/dialoghelper.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ Instead, you can use the
186186
method, which makes sure that the user can only enter a valid string
187187
from a predefined list::
188188

189-
$dialog = $app->getHelperSet()->get('dialog');
189+
$dialog = $this->getHelperSet()->get('dialog');
190190
$colors = array('red', 'blue', 'yellow');
191191

192192
$color = $dialog->select(

components/dependency_injection/compilation.rst

+3-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ Compiling the Container
77
The service container can be compiled for various reasons. These reasons
88
include checking for any potential issues such as circular references and
99
making the container more efficient by resolving parameters and removing
10-
unused services.
10+
unused services. Also, certain features - like using
11+
:doc:`parent services </components/dependency_injection/parentservices>` -
12+
require the container to be compiled.
1113

1214
It is compiled by running::
1315

components/dependency_injection/configurators.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ in a class. The service instance is passed to the callable, allowing the
1212
configurator to do whatever it needs to configure the service after its
1313
creation.
1414

15-
A Service Configurator can be used, for example, when you a have a service that
15+
A Service Configurator can be used, for example, when you have a service that
1616
requires complex setup based on configuration settings coming from different
1717
sources/services. Using an external configurator, you can maintain the service
1818
implementation cleanly and keep it decoupled from the other objects that provide

components/event_dispatcher/introduction.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ The Symfony2 EventDispatcher component implements the `Mediator`_ pattern in
2424
a simple and effective way to make all these things possible and to make your
2525
projects truly extensible.
2626

27-
Take a simple example from the :doc:`/components/http_kernel/introduction`. Once a
27+
Take a simple example from :doc:`/components/http_kernel/introduction`. Once a
2828
``Response`` object has been created, it may be useful to allow other elements
2929
in the system to modify it (e.g. add some cache headers) before it's actually
3030
used. To make this possible, the Symfony2 kernel throws an event -

components/http_foundation/sessions.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ Session attributes
113113
* :method:`Symfony\\Component\\HttpFoundation\\Session\\Session::clear`:
114114
Clear all attributes.
115115

116-
The attributes are stored internally in an "Bag", a PHP object that acts like
116+
The attributes are stored internally in a "Bag", a PHP object that acts like
117117
an array. A few methods exist for "Bag" management:
118118

119119
* :method:`Symfony\\Component\\HttpFoundation\\Session\\Session::registerBag`:
@@ -137,7 +137,7 @@ Session Data Management
137137
~~~~~~~~~~~~~~~~~~~~~~~
138138

139139
PHP's session management requires the use of the ``$_SESSION`` super-global,
140-
however, this interferes somewhat with code testability and encapsulation in a
140+
however, this interferes somewhat with code testability and encapsulation in an
141141
OOP paradigm. To help overcome this, Symfony2 uses *session bags* linked to the
142142
session to encapsulate a specific dataset of attributes or flash messages.
143143

@@ -236,7 +236,7 @@ Flash Messages
236236

237237
The purpose of the :class:`Symfony\\Component\\HttpFoundation\\Session\\Flash\\FlashBagInterface`
238238
is to provide a way of setting and retrieving messages on a per session basis.
239-
The usual workflow for flash messages would be set in an request, and displayed
239+
The usual workflow would be to set flash messages in a request and to display them
240240
after a page redirect. For example, a user submits a form which hits an update
241241
controller, and after processing the controller redirects the page to either the
242242
updated page or an error page. Flash messages set in the previous page request

components/using_components.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ one or more components, the easiest way to integrate everything is with `Compose
1010
Composer is smart enough to download the component(s) that you need and take
1111
care of autoloading so that you can begin using the libraries immediately.
1212

13-
This article will take you through using the :doc:`/components/finder`, though
13+
This article will take you through using :doc:`/components/finder`, though
1414
this applies to using any component.
1515

1616
Using the Finder Component

cookbook/logging/monolog.rst

+99-2
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ allows you to log the messages in several ways easily.
7979
.. code-block:: xml
8080
8181
<!-- app/config/config.xml -->
82+
<?xml version="1.0" encoding="UTF-8" ?>
8283
<container xmlns="http://symfony.com/schema/dic/services"
8384
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
8485
xmlns:monolog="http://symfony.com/schema/dic/monolog"
@@ -179,6 +180,7 @@ easily. Your formatter must implement
179180
.. code-block:: xml
180181
181182
<!-- app/config/config.xml -->
183+
<?xml version="1.0" encoding="UTF-8" ?>
182184
<container xmlns="http://symfony.com/schema/dic/services"
183185
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
184186
xmlns:monolog="http://symfony.com/schema/dic/monolog"
@@ -293,6 +295,8 @@ using a processor.
293295
294296
.. code-block:: xml
295297
298+
<!-- app/config/config.xml -->
299+
<?xml version="1.0" encoding="UTF-8" ?>
296300
<container xmlns="http://symfony.com/schema/dic/services"
297301
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
298302
xmlns:monolog="http://symfony.com/schema/dic/monolog"
@@ -346,8 +350,101 @@ using a processor.
346350
347351
.. note::
348352

349-
If you use several handlers, you can also register the processor at the
350-
handler level instead of globally.
353+
If you use several handlers, you can also register a processor at the
354+
handler level or at the channel level instead of registering it globally
355+
(see the following sections).
356+
357+
Registering Processors per Handler
358+
----------------------------------
359+
360+
You can register a processor per handler using the ``handler`` option of
361+
the ``monolog.processor`` tag:
362+
363+
.. configuration-block::
364+
365+
.. code-block:: yaml
366+
367+
# app/config/config.yml
368+
services:
369+
monolog.processor.session_request:
370+
class: Acme\MyBundle\SessionRequestProcessor
371+
arguments: ["@session"]
372+
tags:
373+
- { name: monolog.processor, method: processRecord, handler: main }
374+
375+
.. code-block:: xml
376+
377+
<!-- app/config/config.xml -->
378+
<?xml version="1.0" encoding="UTF-8" ?>
379+
<container xmlns="http://symfony.com/schema/dic/services"
380+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
381+
xmlns:monolog="http://symfony.com/schema/dic/monolog"
382+
xsi:schemaLocation="http://symfony.com/schema/dic/services
383+
http://symfony.com/schema/dic/services/services-1.0.xsd
384+
http://symfony.com/schema/dic/monolog
385+
http://symfony.com/schema/dic/monolog/monolog-1.0.xsd"
386+
>
387+
<services>
388+
<service id="monolog.processor.session_request" class="Acme\MyBundle\SessionRequestProcessor">
389+
<argument type="service" id="session" />
390+
<tag name="monolog.processor" method="processRecord" handler="main" />
391+
</service>
392+
</services>
393+
</container>
394+
395+
.. code-block:: php
396+
397+
// app/config/config.php
398+
$container
399+
->register('monolog.processor.session_request', 'Acme\MyBundle\SessionRequestProcessor')
400+
->addArgument(new Reference('session'))
401+
->addTag('monolog.processor', array('method' => 'processRecord', 'handler' => 'main'));
402+
403+
Registering Processors per Channel
404+
----------------------------------
405+
406+
You can register a processor per channel using the ``channel`` option of
407+
the ``monolog.processor`` tag:
408+
409+
.. configuration-block::
410+
411+
.. code-block:: yaml
412+
413+
# app/config/config.yml
414+
services:
415+
monolog.processor.session_request:
416+
class: Acme\MyBundle\SessionRequestProcessor
417+
arguments: ["@session"]
418+
tags:
419+
- { name: monolog.processor, method: processRecord, channel: main }
420+
421+
.. code-block:: xml
422+
423+
<!-- app/config/config.xml -->
424+
<?xml version="1.0" encoding="UTF-8" ?>
425+
<container xmlns="http://symfony.com/schema/dic/services"
426+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
427+
xmlns:monolog="http://symfony.com/schema/dic/monolog"
428+
xsi:schemaLocation="http://symfony.com/schema/dic/services
429+
http://symfony.com/schema/dic/services/services-1.0.xsd
430+
http://symfony.com/schema/dic/monolog
431+
http://symfony.com/schema/dic/monolog/monolog-1.0.xsd"
432+
>
433+
<services>
434+
<service id="monolog.processor.session_request" class="Acme\MyBundle\SessionRequestProcessor">
435+
<argument type="service" id="session" />
436+
<tag name="monolog.processor" method="processRecord" channel="main" />
437+
</service>
438+
</services>
439+
</container>
440+
441+
.. code-block:: php
442+
443+
// app/config/config.php
444+
$container
445+
->register('monolog.processor.session_request', 'Acme\MyBundle\SessionRequestProcessor')
446+
->addArgument(new Reference('session'))
447+
->addTag('monolog.processor', array('method' => 'processRecord', 'channel' => 'main'));
351448
352449
.. _Monolog: https://github.com/Seldaek/monolog
353450
.. _LoggerInterface: https://github.com/php-fig/log/blob/master/Psr/Log/LoggerInterface.php

0 commit comments

Comments
 (0)