Skip to content

Commit

Permalink
fix: handle case where ProfilerController is not available (#80)
Browse files Browse the repository at this point in the history
  • Loading branch information
priyadi authored Mar 12, 2024
1 parent 9d8cc9c commit c2d065e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 2.2.2

* fix: handle case where `ProfilerController` is not available

## 2.2.1

* feat: run message relay on `console.terminate` event
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
use Rekalogika\DomainEvent\DependencyInjection\Constants;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException;

/**
* Workaround for this error:
Expand All @@ -34,9 +35,13 @@ final class ProfilerWorkaroundPass implements CompilerPassInterface
{
public function process(ContainerBuilder $container): void
{
$doctrine = $container->getDefinition(Constants::REAL_MANAGER_REGISTRY);
try {
$doctrine = $container->getDefinition(Constants::REAL_MANAGER_REGISTRY);

$profilerController = $container->getDefinition(ProfilerController::class);
$profilerController->setArgument(1, $doctrine);
$profilerController = $container->getDefinition(ProfilerController::class);
$profilerController->setArgument(1, $doctrine);
} catch (ServiceNotFoundException) {
// ignore
}
}
}

0 comments on commit c2d065e

Please sign in to comment.