@@ -20,11 +20,9 @@ Instead, you can run the command directly from the controller.
20
20
a controller has a slight performance impact because of the request stack
21
21
overhead.
22
22
23
- Imagine you want to send spooled Swift Mailer messages by
24
- :doc: `using the swiftmailer:spool:send command </email >`.
25
- Run this command from inside your controller via::
23
+ Imagine you want to run the ``debug:twig `` from inside your controller::
26
24
27
- // src/Controller/SpoolController .php
25
+ // src/Controller/DebugTwigController .php
28
26
namespace App\Controller;
29
27
30
28
use Symfony\Bundle\FrameworkBundle\Console\Application;
@@ -34,19 +32,19 @@ Run this command from inside your controller via::
34
32
use Symfony\Component\HttpFoundation\Response;
35
33
use Symfony\Component\HttpKernel\KernelInterface;
36
34
37
- class SpoolController extends AbstractController
35
+ class DebugTwigController extends AbstractController
38
36
{
39
- public function sendSpool(int $messages = 10, KernelInterface $kernel): Response
37
+ public function debugTwig( KernelInterface $kernel): Response
40
38
{
41
39
$application = new Application($kernel);
42
40
$application->setAutoExit(false);
43
41
44
42
$input = new ArrayInput([
45
- 'command' => 'swiftmailer:spool:send ',
43
+ 'command' => 'debug:twig ',
46
44
// (optional) define the value of command arguments
47
45
'fooArgument' => 'barValue',
48
46
// (optional) pass options to the command
49
- '--message-limit ' => $messages ,
47
+ '--bar ' => 'fooValue' ,
50
48
]);
51
49
52
50
// You can use NullOutput() if you don't need the output
@@ -76,7 +74,7 @@ First, require the package:
76
74
77
75
Now, use it in your controller::
78
76
79
- // src/Controller/SpoolController .php
77
+ // src/Controller/DebugTwigController .php
80
78
namespace App\Controller;
81
79
82
80
use SensioLabs\AnsiConverter\AnsiToHtmlConverter;
@@ -85,7 +83,7 @@ Now, use it in your controller::
85
83
use Symfony\Component\HttpFoundation\Response;
86
84
// ...
87
85
88
- class SpoolController extends AbstractController
86
+ class DebugTwigController extends AbstractController
89
87
{
90
88
public function sendSpool(int $messages = 10): Response
91
89
{
0 commit comments