Permalink
Browse files

minor #4422 Fix typos in code (ifdattic)

This PR was merged into the 2.3 branch.

Discussion
----------

Fix typos in code

| Q             | A
| ------------- | ---
| Doc fix?      | yes
| New docs?     | no
| Applies to    | 2.3
| Fixed tickets |

PS 1: As so far I used only yaml files for services not sure if the changes to XML and PHP code blocks are correct

PS 2: Maybe I configured something wrong or something like that (or you could point me in the right direction for more information), but I don't think the terminate listener will work. In my opinion when command is exited with exception the exit code should be more than zero, but on `ConsoleTerminateEvent` and even on `ConsoleExceptionEvent` the exit code is `0`

Commits
-------

2135b82 Change: ConsoleTerminateListener => ErrorLoggerListener
fc403b1 Removed parameters from service
d4ba3c0 Fix typos in code
  • Loading branch information...
weaverryan committed Dec 5, 2014
2 parents 4257a27 + 2135b82 commit 0a9c1467aa858ba9407963cef8455488b2a31877
Showing with 8 additions and 16 deletions.
  1. +8 −16 cookbook/console/logging.rst
@@ -190,7 +190,7 @@ First configure a listener for console terminate events in the service container
# app/config/services.yml
services:
kernel.listener.command_dispatch:
class: Acme\DemoBundle\EventListener\ConsoleTerminateListener
class: Acme\DemoBundle\EventListener\ErrorLoggerListener
arguments:
logger: "@logger"
tags:
@@ -204,12 +204,8 @@ First configure a listener for console terminate events in the service container
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<parameters>
<parameter key="console_exception_listener.class">Acme\DemoBundle\EventListener\ConsoleExceptionListener</parameter>
</parameters>
<services>
<service id="kernel.listener.command_dispatch" class="%console_exception_listener.class%">
<service id="kernel.listener.command_dispatch" class="Acme\DemoBundle\EventListener\ErrorLoggerListener">
<argument type="service" id="logger"/>
<tag name="kernel.event_listener" event="console.terminate" />
</service>
@@ -222,32 +218,28 @@ First configure a listener for console terminate events in the service container
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Reference;
$container->setParameter(
'console_exception_listener.class',
'Acme\DemoBundle\EventListener\ConsoleExceptionListener'
);
$definitionConsoleExceptionListener = new Definition(
'%console_exception_listener.class%',
$definitionErrorLoggerListener = new Definition(
'Acme\DemoBundle\EventListener\ErrorLoggerListener',
array(new Reference('logger'))
);
$definitionConsoleExceptionListener->addTag(
$definitionErrorLoggerListener->addTag(
'kernel.event_listener',
array('event' => 'console.terminate')
);
$container->setDefinition(
'kernel.listener.command_dispatch',
$definitionConsoleExceptionListener
$definitionErrorLoggerListener
);
Then implement the actual listener::
// src/Acme/DemoBundle/EventListener/ConsoleExceptionListener.php
// src/Acme/DemoBundle/EventListener/ErrorLoggerListener.php
namespace Acme\DemoBundle\EventListener;
use Symfony\Component\Console\Event\ConsoleTerminateEvent;
use Psr\Log\LoggerInterface;
class ConsoleExceptionListener
class ErrorLoggerListener
{
private $logger;

0 comments on commit 0a9c146

Please sign in to comment.