Skip to content

Commit

Permalink
Add option to configure redirect admin list configurator class
Browse files Browse the repository at this point in the history
  • Loading branch information
Danny van Wijk committed Mar 14, 2024
1 parent 2a9fd45 commit 3cfd4fd
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
use Kunstmaan\AdminBundle\Helper\DomainConfigurationInterface;
use Kunstmaan\AdminListBundle\AdminList\Configurator\AdminListConfiguratorInterface;
use Kunstmaan\AdminListBundle\Controller\AbstractAdminListController;
use Kunstmaan\RedirectBundle\AdminList\RedirectAdminListConfigurator;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
Expand All @@ -28,7 +27,8 @@ public function __construct(DomainConfigurationInterface $domainConfiguration)
public function getAdminListConfigurator()
{
if (!isset($this->configurator)) {
$this->configurator = new RedirectAdminListConfigurator($this->getEntityManager(), null, $this->domainConfiguration);
$configuratorClass = $this->getParameter('kunstmaan_redirect.adminlist.redirect_configurator.class');
$this->configurator = new $configuratorClass($this->getEntityManager(), null, $this->domainConfiguration);
}

return $this->configurator;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Kunstmaan\RedirectBundle\DependencyInjection;

use Kunstmaan\RedirectBundle\AdminList\RedirectAdminListConfigurator;
use Kunstmaan\RedirectBundle\Entity\Redirect;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;
Expand All @@ -19,6 +20,7 @@ public function getConfigTreeBuilder()
$rootNode
->children()
->scalarNode('redirect_entity')->defaultValue(Redirect::class)->end()
->scalarNode('redirect_adminlist')->defaultValue(RedirectAdminListConfigurator::class)->end()
->booleanNode('enable_improved_router')->defaultFalse()->end()
->end()
;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public function load(array $configs, ContainerBuilder $container)
$loader->load('services.yml');

$container->setParameter('kunstmaan_redirect.redirect.class', $config['redirect_entity']);
$container->setParameter('kunstmaan_redirect.adminlist.redirect_configurator.class', $config['redirect_adminlist']);

$enableImprovedRouter = $config['enable_improved_router'] ?? false;
$container->setParameter('.kunstmaan_redirect.enable_improved_router', $enableImprovedRouter);
Expand Down

0 comments on commit 3cfd4fd

Please sign in to comment.