forked from netgen/NetgenEzSyliusBundle
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use compiler passes to override vendor services
- Loading branch information
Showing
5 changed files
with
83 additions
and
14 deletions.
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
DependencyInjection/CompilerPass/LegacyCachePurgerPass.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
|
||
namespace Netgen\Bundle\EzSyliusBundle\DependencyInjection\CompilerPass; | ||
|
||
use Netgen\Bundle\EzSyliusBundle\Cache\LegacyCachePurger; | ||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; | ||
use Symfony\Component\DependencyInjection\ContainerBuilder; | ||
|
||
class LegacyCachePurgerPass implements CompilerPassInterface | ||
{ | ||
/** | ||
* You can modify the container here before it is dumped to PHP code. | ||
* | ||
* @param \Symfony\Component\DependencyInjection\ContainerBuilder $container | ||
*/ | ||
public function process(ContainerBuilder $container) | ||
{ | ||
if (!$container->has('ezpublish_legacy.legacy_cache_purger')) { | ||
return; | ||
} | ||
|
||
// Overrides Legacy Bridge cache purger to set "quiet" flag to eZCLI, | ||
// since it crashes Sylius installation procedure. | ||
|
||
$container | ||
->findDefinition('ezpublish_legacy.legacy_cache_purger') | ||
->setClass(LegacyCachePurger::class); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
|
||
namespace Netgen\Bundle\EzSyliusBundle\DependencyInjection\CompilerPass; | ||
|
||
use Netgen\Bundle\EzSyliusBundle\Authentication\AuthenticationSuccessHandler; | ||
use Netgen\Bundle\EzSyliusBundle\Authentication\DaoAuthenticationProvider; | ||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; | ||
use Symfony\Component\DependencyInjection\ContainerBuilder; | ||
|
||
class SecurityPass implements CompilerPassInterface | ||
{ | ||
/** | ||
* You can modify the container here before it is dumped to PHP code. | ||
* | ||
* @param \Symfony\Component\DependencyInjection\ContainerBuilder $container | ||
*/ | ||
public function process(ContainerBuilder $container) | ||
{ | ||
if ($container->has('security.authentication.success_handler')) { | ||
$container | ||
->findDefinition('security.authentication.success_handler') | ||
->setClass(AuthenticationSuccessHandler::class); | ||
} | ||
|
||
if ($container->has('security.authentication.provider.dao')) { | ||
$container | ||
->findDefinition('security.authentication.provider.dao') | ||
->setClass(DaoAuthenticationProvider::class); | ||
} | ||
|
||
if ($container->has('sylius.authentication.success_handler')) { | ||
$container | ||
->findDefinition('sylius.authentication.success_handler') | ||
->setClass(AuthenticationSuccessHandler::class); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.