File tree Expand file tree Collapse file tree 3 files changed +27
-6
lines changed Expand file tree Collapse file tree 3 files changed +27
-6
lines changed Original file line number Diff line number Diff line change 4
4
How to Override any Part of a Bundle
5
5
====================================
6
6
7
- This document is a quick reference for how to override different parts of
8
- third-party bundles without using :doc: ` /bundles/inheritance `, which was
9
- removed in Symfony 4.0 .
7
+ When using a third-party bundle, you might want to customize or override some of
8
+ its features. This document describes ways of overriding the most common
9
+ features of a bundle .
10
10
11
11
.. tip ::
12
12
Original file line number Diff line number Diff line change @@ -97,10 +97,10 @@ thrown by the application.
97
97
Listeners receive a
98
98
:class: `Symfony\\ Component\\ Console\\ Event\\ ConsoleExceptionEvent ` event::
99
99
100
- use Symfony\Component\Console\Event\ConsoleExceptionEvent ;
100
+ use Symfony\Component\Console\Event\ConsoleErrorEvent ;
101
101
use Symfony\Component\Console\ConsoleEvents;
102
102
103
- $dispatcher->addListener(ConsoleEvents::ERROR, function (ConsoleExceptionEvent $event) {
103
+ $dispatcher->addListener(ConsoleEvents::ERROR, function (ConsoleErrorEvent $event) {
104
104
$output = $event->getOutput();
105
105
106
106
$command = $event->getCommand();
@@ -111,7 +111,7 @@ Listeners receive a
111
111
$exitCode = $event->getExitCode();
112
112
113
113
// change the exception to another one
114
- $event->setException(new \LogicException('Caught exception', $exitCode, $event->getException ()));
114
+ $event->setException(new \LogicException('Caught exception', $exitCode, $event->getError ()));
115
115
});
116
116
117
117
The ``ConsoleEvents::TERMINATE `` Event
Original file line number Diff line number Diff line change @@ -8,3 +8,24 @@ How to Use Matchers to Enable the Profiler Conditionally
8
8
9
9
The possibility to use a matcher to enable the profiler conditionally was
10
10
removed in Symfony 4.0.
11
+
12
+ Symfony Profiler cannot be enabled/disabled conditionally using matchers, because
13
+ that feature was removed in Symfony 4.0. However, you can use the ``enable() ``
14
+ and ``disable() `` methods of the :class: `Symfony\\ Component\\ HttpKernel\\ Profiler\\ Profiler `
15
+ class in your controllers to manage the profiler programmatically::
16
+
17
+ use Symfony\Component\HttpKernel\Profiler\Profiler;
18
+ // ...
19
+
20
+ class DefaultController
21
+ {
22
+ // ...
23
+
24
+ public function someMethod(Profiler $profiler)
25
+ {
26
+ // for this particular controller action, the profiler is disabled
27
+ $profiler->disable();
28
+
29
+ // ...
30
+ }
31
+ }
You can’t perform that action at this time.
0 commit comments