Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validation override fix #406

Merged
merged 16 commits into from
Dec 8, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
AuthenticationManagerPolyfillPass.php as temp fix for non-existing de…
…pendency: security.authentication_manager
  • Loading branch information
piotrleo committed Dec 7, 2021
commit 065cd47d6eaa059a80e342c532695eaeadd2e874
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

namespace BitBag\SyliusCmsPlugin\DependencyInjection\Compiler;

use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;

class AuthenticationManagerPolyfillPass implements CompilerPassInterface
{
public function process(ContainerBuilder $container): void
{
if (
$container->has('security.authentication_manager') === false
&&
$container->has('security.authentication.manager') === true
) {
$container->setAlias('security.authentication_manager', 'security.authentication.manager');
}
}
}
8 changes: 8 additions & 0 deletions tests/Application/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Tests\BitBag\SyliusCmsPlugin\Application;

use BitBag\SyliusCmsPlugin\DependencyInjection\Compiler\AuthenticationManagerPolyfillPass;
use PSS\SymfonyMockerContainer\DependencyInjection\MockerContainer;
use Sylius\Bundle\CoreBundle\Application\Kernel as SyliusKernel;
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
Expand Down Expand Up @@ -107,6 +108,13 @@ private function registerBundlesFromFile(string $bundlesFile): iterable
}
}

protected function build(ContainerBuilder $container)
{
parent::build($container);

$container->addCompilerPass(new AuthenticationManagerPolyfillPass());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be present in Plugin class in src. Currently, it's limited to test application, IMO it should be attached wherever needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

}

/**
* @return string[]
*/
Expand Down