Skip to content

Commit

Permalink
bug #52963 [FrameworkBundle] Fix profiling commands without router (H…
Browse files Browse the repository at this point in the history
…eahDude)

This PR was merged into the 6.4 branch.

Discussion
----------

[FrameworkBundle] Fix profiling commands without router

| Q             | A
| ------------- | ---
| Branch?       | 6.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Issues        | #52943
| License       | MIT

Commits
-------

7fba074 [FrameworkBundle] Fix profiling commands without router
  • Loading branch information
fabpot committed Dec 9, 2023
2 parents f0099d9 + 7fba074 commit fec8909
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
Expand Up @@ -43,7 +43,7 @@ public function __construct(
private readonly RequestStack $requestStack,
private readonly Stopwatch $stopwatch,
private readonly bool $cliMode,
private readonly UrlGeneratorInterface $urlGenerator,
private readonly ?UrlGeneratorInterface $urlGenerator = null,
) {
$this->profiles = new \SplObjectStorage();
$this->parents = new \SplObjectStorage();
Expand Down Expand Up @@ -140,12 +140,14 @@ public function profile(ConsoleTerminateEvent $event): void
$p = $this->profiles[$r];
$this->profiler->saveProfile($p);

$token = $p->getToken();
$output?->writeln(sprintf(
'See profile <href=%s>%s</>',
$this->urlGenerator->generate('_profiler', ['token' => $token], UrlGeneratorInterface::ABSOLUTE_URL),
$token
));
if ($this->urlGenerator && $output) {
$token = $p->getToken();
$output->writeln(sprintf(
'See profile <href=%s>%s</>',
$this->urlGenerator->generate('_profiler', ['token' => $token], UrlGeneratorInterface::ABSOLUTE_URL),
$token
));
}
}

$this->profiles = new \SplObjectStorage();
Expand Down
Expand Up @@ -44,7 +44,7 @@
service('.virtual_request_stack'),
service('debug.stopwatch'),
param('kernel.runtime_mode.cli'),
service('router'),
service('router')->nullOnInvalid(),
])
->tag('kernel.event_subscriber')

Expand Down

0 comments on commit fec8909

Please sign in to comment.