From c845ce2d89562b13fb10a3bd16c04b7ea39e70c8 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Tue, 15 Apr 2014 18:39:28 +0200 Subject: [PATCH 1/4] [Components][DependencyInjection] add note about a use case that requires to compile the container --- components/dependency_injection/compilation.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/components/dependency_injection/compilation.rst b/components/dependency_injection/compilation.rst index a90110e4e65..f83a9e8e84d 100644 --- a/components/dependency_injection/compilation.rst +++ b/components/dependency_injection/compilation.rst @@ -7,7 +7,9 @@ Compiling the Container The service container can be compiled for various reasons. These reasons include checking for any potential issues such as circular references and making the container more efficient by resolving parameters and removing -unused services. +unused services. Also, certain features - like using +:doc:`parent services ` - +require the container to be compiled. It is compiled by running:: From 8a83649a76a8d816e6e0daf37a8ed6bc665f4118 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Fri, 9 May 2014 10:58:01 +0200 Subject: [PATCH 2/4] register processor per handler and per channel --- cookbook/logging/monolog.rst | 101 ++++++++++++++++++++++++++++++++++- 1 file changed, 99 insertions(+), 2 deletions(-) diff --git a/cookbook/logging/monolog.rst b/cookbook/logging/monolog.rst index 32e064598e1..e4f26b282a9 100644 --- a/cookbook/logging/monolog.rst +++ b/cookbook/logging/monolog.rst @@ -80,6 +80,7 @@ allows you to log the messages in several ways easily. .. code-block:: xml + + + + + + + + + + + + + + .. code-block:: php + + // app/config/config.php + $container + ->register('monolog.processor.session_request', 'Acme\MyBundle\SessionRequestProcessor') + ->addArgument(new Reference('session')) + ->addTag('monolog.processor', array('method' => 'processRecord', 'handler' => 'main')); + +Registering Processors per Channel +---------------------------------- + +You can register a processor per channel using the ``channel`` option of +the ``monolog.processor`` tag: + +.. configuration-block:: + + .. code-block:: yaml + + # app/config/config.yml + services: + monolog.processor.session_request: + class: Acme\MyBundle\SessionRequestProcessor + arguments: ["@session"] + tags: + - { name: monolog.processor, method: processRecord, channel: main } + + .. code-block:: xml + + + + + + + + + + + + + .. code-block:: php + + // app/config/config.php + $container + ->register('monolog.processor.session_request', 'Acme\MyBundle\SessionRequestProcessor') + ->addArgument(new Reference('session')) + ->addTag('monolog.processor', array('method' => 'processRecord', 'channel' => 'main')); .. _Monolog: https://github.com/Seldaek/monolog From 86d1cf3549a7b3ff0d969b9f5aa1afeb0b13dfce Mon Sep 17 00:00:00 2001 From: Ahmed Siouani Date: Fri, 9 May 2014 18:12:26 +0200 Subject: [PATCH 3/4] Fixed some minor typos. --- components/dependency_injection/configurators.rst | 2 +- components/event_dispatcher/introduction.rst | 2 +- components/http_foundation/sessions.rst | 6 +++--- components/using_components.rst | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/components/dependency_injection/configurators.rst b/components/dependency_injection/configurators.rst index 1702afc9413..653da0cee02 100644 --- a/components/dependency_injection/configurators.rst +++ b/components/dependency_injection/configurators.rst @@ -12,7 +12,7 @@ in a class. The service instance is passed to the callable, allowing the configurator to do whatever it needs to configure the service after its creation. -A Service Configurator can be used, for example, when you a have a service that +A Service Configurator can be used, for example, when you have a service that requires complex setup based on configuration settings coming from different sources/services. Using an external configurator, you can maintain the service implementation cleanly and keep it decoupled from the other objects that provide diff --git a/components/event_dispatcher/introduction.rst b/components/event_dispatcher/introduction.rst index 0ea96b89abc..905ea4e844c 100644 --- a/components/event_dispatcher/introduction.rst +++ b/components/event_dispatcher/introduction.rst @@ -24,7 +24,7 @@ The Symfony2 EventDispatcher component implements the `Mediator`_ pattern in a simple and effective way to make all these things possible and to make your projects truly extensible. -Take a simple example from the :doc:`/components/http_kernel/introduction`. Once a +Take a simple example from :doc:`/components/http_kernel/introduction`. Once a ``Response`` object has been created, it may be useful to allow other elements in the system to modify it (e.g. add some cache headers) before it's actually used. To make this possible, the Symfony2 kernel throws an event - diff --git a/components/http_foundation/sessions.rst b/components/http_foundation/sessions.rst index dd5ddfdba54..bf0f18bd7d6 100644 --- a/components/http_foundation/sessions.rst +++ b/components/http_foundation/sessions.rst @@ -107,7 +107,7 @@ Session attributes * :method:`Symfony\\Component\\HttpFoundation\\Session\\Session::clear`: Clear all attributes. -The attributes are stored internally in an "Bag", a PHP object that acts like +The attributes are stored internally in a "Bag", a PHP object that acts like an array. A few methods exist for "Bag" management: * :method:`Symfony\\Component\\HttpFoundation\\Session\\Session::registerBag`: @@ -131,7 +131,7 @@ Session Data Management ~~~~~~~~~~~~~~~~~~~~~~~ PHP's session management requires the use of the ``$_SESSION`` super-global, -however, this interferes somewhat with code testability and encapsulation in a +however, this interferes somewhat with code testability and encapsulation in an OOP paradigm. To help overcome this, Symfony2 uses *session bags* linked to the session to encapsulate a specific dataset of attributes or flash messages. @@ -230,7 +230,7 @@ Flash messages The purpose of the :class:`Symfony\\Component\\HttpFoundation\\Session\\Flash\\FlashBagInterface` is to provide a way of setting and retrieving messages on a per session basis. -The usual workflow for flash messages would be set in an request, and displayed +The usual workflow would be to set flash messages in a request and to display them after a page redirect. For example, a user submits a form which hits an update controller, and after processing the controller redirects the page to either the updated page or an error page. Flash messages set in the previous page request diff --git a/components/using_components.rst b/components/using_components.rst index bf8f260ac87..3ebcf01aa9d 100644 --- a/components/using_components.rst +++ b/components/using_components.rst @@ -10,7 +10,7 @@ one or more components, the easiest way to integrate everything is with `Compose Composer is smart enough to download the component(s) that you need and take care of autoloading so that you can begin using the libraries immediately. -This article will take you through using the :doc:`/components/finder`, though +This article will take you through using :doc:`/components/finder`, though this applies to using any component. Using the Finder Component From cd7bf32e4b8f56ebd7ccf908c192e004a40bc7f2 Mon Sep 17 00:00:00 2001 From: Dennis Bijsterveld Date: Fri, 9 May 2014 16:14:15 +0200 Subject: [PATCH 4/4] Update dialoghelper.rst Consistent use of $this->getHelperSet() --- components/console/helpers/dialoghelper.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/console/helpers/dialoghelper.rst b/components/console/helpers/dialoghelper.rst index 8cef76d6ff2..ff6ca161c5d 100644 --- a/components/console/helpers/dialoghelper.rst +++ b/components/console/helpers/dialoghelper.rst @@ -192,7 +192,7 @@ Instead, you can use the method, which makes sure that the user can only enter a valid string from a predefined list:: - $dialog = $app->getHelperSet()->get('dialog'); + $dialog = $this->getHelperSet()->get('dialog'); $colors = array('red', 'blue', 'yellow'); $color = $dialog->select(