mirror of
https://github.com/symfony/symfony-docs.git
synced 2026-03-24 00:32:14 +01:00
Merge branch '4.4' into 5.3
* 4.4: Take into account the EOM of Swiftmailer in docs
This commit is contained in:
@@ -498,12 +498,6 @@ as possible to the client (e.g. sending emails).
|
||||
Using the ``kernel.terminate`` event is optional, and should only be
|
||||
called if your kernel implements :class:`Symfony\\Component\\HttpKernel\\TerminableInterface`.
|
||||
|
||||
.. sidebar:: ``kernel.terminate`` in the Symfony Framework
|
||||
|
||||
If you use the :ref:`memory spooling <email-spool-memory>` option of the
|
||||
default Symfony mailer, then the `EmailSenderListener`_ is activated, which
|
||||
actually delivers any emails that you scheduled to send during the request.
|
||||
|
||||
.. _component-http-kernel-kernel-exception:
|
||||
|
||||
Handling Exceptions: the ``kernel.exception`` Event
|
||||
@@ -758,5 +752,4 @@ Learn more
|
||||
.. _`SensioFrameworkExtraBundle`: https://symfony.com/doc/current/bundles/SensioFrameworkExtraBundle/index.html
|
||||
.. _`@ParamConverter`: https://symfony.com/doc/current/bundles/SensioFrameworkExtraBundle/annotations/converters.html
|
||||
.. _`@Template`: https://symfony.com/doc/current/bundles/SensioFrameworkExtraBundle/annotations/view.html
|
||||
.. _`EmailSenderListener`: https://github.com/symfony/swiftmailer-bundle/blob/master/EventListener/EmailSenderListener.php
|
||||
.. _variadic: https://www.php.net/manual/en/functions.arguments.php#functions.variable-arg-list
|
||||
|
||||
@@ -20,11 +20,9 @@ Instead, you can run the command directly from the controller.
|
||||
a controller has a slight performance impact because of the request stack
|
||||
overhead.
|
||||
|
||||
Imagine you want to send spooled Swift Mailer messages by
|
||||
:doc:`using the swiftmailer:spool:send command </email>`.
|
||||
Run this command from inside your controller via::
|
||||
Imagine you want to run the ``debug:twig`` from inside your controller::
|
||||
|
||||
// src/Controller/SpoolController.php
|
||||
// src/Controller/DebugTwigController.php
|
||||
namespace App\Controller;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Console\Application;
|
||||
@@ -34,19 +32,19 @@ Run this command from inside your controller via::
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\KernelInterface;
|
||||
|
||||
class SpoolController extends AbstractController
|
||||
class DebugTwigController extends AbstractController
|
||||
{
|
||||
public function sendSpool(int $messages = 10, KernelInterface $kernel): Response
|
||||
public function debugTwig(KernelInterface $kernel): Response
|
||||
{
|
||||
$application = new Application($kernel);
|
||||
$application->setAutoExit(false);
|
||||
|
||||
$input = new ArrayInput([
|
||||
'command' => 'swiftmailer:spool:send',
|
||||
'command' => 'debug:twig',
|
||||
// (optional) define the value of command arguments
|
||||
'fooArgument' => 'barValue',
|
||||
// (optional) pass options to the command
|
||||
'--message-limit' => $messages,
|
||||
'--bar' => 'fooValue',
|
||||
]);
|
||||
|
||||
// You can use NullOutput() if you don't need the output
|
||||
@@ -76,7 +74,7 @@ First, require the package:
|
||||
|
||||
Now, use it in your controller::
|
||||
|
||||
// src/Controller/SpoolController.php
|
||||
// src/Controller/DebugTwigController.php
|
||||
namespace App\Controller;
|
||||
|
||||
use SensioLabs\AnsiConverter\AnsiToHtmlConverter;
|
||||
@@ -85,7 +83,7 @@ Now, use it in your controller::
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
// ...
|
||||
|
||||
class SpoolController extends AbstractController
|
||||
class DebugTwigController extends AbstractController
|
||||
{
|
||||
public function sendSpool(int $messages = 10): Response
|
||||
{
|
||||
|
||||
@@ -4,10 +4,11 @@
|
||||
Swift Mailer
|
||||
============
|
||||
|
||||
.. note::
|
||||
.. caution::
|
||||
|
||||
In Symfony 4.3, the :doc:`Mailer </mailer>` component was introduced and can
|
||||
be used instead of Swift Mailer.
|
||||
In Symfony 4.3, the :doc:`Mailer </mailer>` component was introduced and should
|
||||
be used instead of Swift Mailer as it won't be maintained anymore as of November
|
||||
2021.
|
||||
|
||||
Symfony provides a mailer feature based on the popular `Swift Mailer`_ library
|
||||
via the `SwiftMailerBundle`_. This mailer supports sending messages with your
|
||||
|
||||
@@ -82,7 +82,7 @@ Setting up Composer
|
||||
Another point you will have to look out for is conflicts between
|
||||
dependencies in both applications. This is especially important if your
|
||||
existing application already uses Symfony components or libraries commonly
|
||||
used in Symfony applications such as Doctrine ORM, Swiftmailer or Twig.
|
||||
used in Symfony applications such as Doctrine ORM or Twig.
|
||||
A good way for ensuring compatibility is to use the same ``composer.json``
|
||||
for both project's dependencies.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user