bug #32958 [Mailer] Make the message logger permanent (fabpot)

This PR was merged into the 4.4 branch.

Discussion
----------

[Mailer] Make the message logger permanent

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | yes
| New feature?  | no <!-- please update src/**/CHANGELOG.md files -->
| BC breaks?    | no     <!-- see https://symfony.com/bc -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->
| Fixed tickets | n/a
| License       | MIT
| Doc PR        | n/a

<!--
Replace this notice by a short README for your feature/bugfix. This will help people
understand your PR and can be used as a start for the documentation.

Additionally (see https://symfony.com/roadmap):
 - Bug fixes must be submitted against the lowest maintained branch where they apply
   (lowest branches are regularly merged to upper ones so they get the fixes too).
 - Features and deprecations must be submitted against branch 4.4.
 - Legacy code removals go to the master branch.
-->

Commits
-------

4aeca4ec9c [Mailer] made the message logger permanent
This commit is contained in:
Fabien Potencier 2019-08-05 19:07:06 +02:00
commit 233562f034
3 changed files with 10 additions and 8 deletions

View File

@ -148,6 +148,7 @@ class FrameworkExtension extends Extension
private $annotationsConfigEnabled = false;
private $validatorConfigEnabled = false;
private $messengerConfigEnabled = false;
private $mailerConfigEnabled = false;
/**
* Responds to the app.config configuration parameter.
@ -343,7 +344,7 @@ class FrameworkExtension extends Extension
$this->registerHttpClientConfiguration($config['http_client'], $container, $loader);
}
if ($this->isConfigEnabled($container, $config['mailer'])) {
if ($this->mailerConfigEnabled = $this->isConfigEnabled($container, $config['mailer'])) {
$this->registerMailerConfiguration($config['mailer'], $container, $loader);
}
@ -553,6 +554,10 @@ class FrameworkExtension extends Extension
$loader->load('messenger_debug.xml');
}
if ($this->mailerConfigEnabled) {
$loader->load('mailer_debug.xml');
}
$container->setParameter('profiler_listener.only_exceptions', $config['only_exceptions']);
$container->setParameter('profiler_listener.only_master_requests', $config['only_master_requests']);
@ -1965,9 +1970,6 @@ class FrameworkExtension extends Extension
}
$loader->load('mailer.xml');
if ($container->getParameter('kernel.debug')) {
$loader->load('mailer_debug.xml');
}
$loader->load('mailer_transports.xml');
$container->getDefinition('mailer.default_transport')->setArgument(0, $config['dsn']);

View File

@ -33,5 +33,9 @@
<argument /> <!-- recipients -->
<tag name="kernel.event_subscriber"/>
</service>
<service id="mailer.logger_message_listener" class="Symfony\Component\Mailer\EventListener\MessageLoggerListener">
<tag name="kernel.event_subscriber"/>
</service>
</services>
</container>

View File

@ -5,10 +5,6 @@
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<services>
<service id="mailer.logger_message_listener" class="Symfony\Component\Mailer\EventListener\MessageLoggerListener">
<tag name="kernel.event_subscriber"/>
</service>
<service id="mailer.data_collector" class="Symfony\Component\Mailer\DataCollector\MessageDataCollector">
<argument type="service" id="mailer.logger_message_listener" />
<tag name="data_collector" template="@WebProfiler/Collector/mailer.html.twig" id="mailer" />