Skip to content

Commit

Permalink
Fixed using missing alias in compiler pass & add test (#167)
Browse files Browse the repository at this point in the history
  • Loading branch information
yann-eugone authored Feb 25, 2025
1 parent 4d6587d commit 359e685
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ final class ConfigureTemplatingPass implements CompilerPassInterface
{
public function process(ContainerBuilder $container): void
{
if (!$container->hasAlias(TemplatingInterface::class)) {
return;
}

$templatingActualService = (string)$container->getAlias(TemplatingInterface::class);

try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
use Yokai\Batch\Bridge\Symfony\Framework\UserInterface\Templating\ConfigurableTemplating;
use Yokai\Batch\Bridge\Symfony\Framework\UserInterface\Templating\SonataAdminTemplating;
use Yokai\Batch\Bridge\Symfony\Framework\UserInterface\Templating\TemplatingInterface;
use Yokai\Batch\Bridge\Symfony\Framework\YokaiBatchBundle;
use Yokai\Batch\Bridge\Symfony\Messenger\DispatchMessageJobLauncher;
use Yokai\Batch\Bridge\Symfony\Uid\Factory\RandomBasedUuidJobExecutionIdGenerator;
use Yokai\Batch\Bridge\Symfony\Uid\Factory\TimeBasedUuidJobExecutionIdGenerator;
Expand Down Expand Up @@ -423,12 +424,16 @@ private function createContainer(array $config, \Closure|null $configure = null)
if ($configure !== null) {
$configure($container);
}
$container->registerExtension(new YokaiBatchExtension());
$bundle = new YokaiBatchBundle();
$extension = $bundle->getContainerExtension();
\assert($extension instanceof YokaiBatchExtension);
$container->registerExtension($extension);
$container->loadFromExtension('yokai_batch', $config);

$container->getCompilerPassConfig()->setOptimizationPasses([]);
$container->getCompilerPassConfig()->setRemovingPasses([]);
$container->getCompilerPassConfig()->setAfterRemovingPasses([]);
$bundle->build($container);
$container->compile();

return $container;
Expand Down

0 comments on commit 359e685

Please sign in to comment.