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 44How to Override any Part of a Bundle
55====================================
66
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 .
1010
1111.. tip ::
1212
Original file line number Diff line number Diff line change @@ -97,10 +97,10 @@ thrown by the application.
9797Listeners receive a
9898:class: `Symfony\\ Component\\ Console\\ Event\\ ConsoleExceptionEvent ` event::
9999
100- use Symfony\Component\Console\Event\ConsoleExceptionEvent ;
100+ use Symfony\Component\Console\Event\ConsoleErrorEvent ;
101101 use Symfony\Component\Console\ConsoleEvents;
102102
103- $dispatcher->addListener(ConsoleEvents::ERROR, function (ConsoleExceptionEvent $event) {
103+ $dispatcher->addListener(ConsoleEvents::ERROR, function (ConsoleErrorEvent $event) {
104104 $output = $event->getOutput();
105105
106106 $command = $event->getCommand();
@@ -111,7 +111,7 @@ Listeners receive a
111111 $exitCode = $event->getExitCode();
112112
113113 // 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 ()));
115115 });
116116
117117The ``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
88
99 The possibility to use a matcher to enable the profiler conditionally was
1010 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