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

Autoconfigure knp_menu.factory_extension tag for ExtensionInterface #474

Merged
merged 1 commit into from
Mar 15, 2024
Merged
Changes from all commits
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
10 changes: 5 additions & 5 deletions src/DependencyInjection/KnpMenuExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Knp\Bundle\MenuBundle\DependencyInjection;

use Knp\Menu\Factory\ExtensionInterface;
use Knp\Menu\ItemInterface;
use Knp\Menu\Matcher\Voter\VoterInterface;
use Symfony\Component\Config\FileLocator;
Expand Down Expand Up @@ -42,11 +43,10 @@ public function load(array $configs, ContainerBuilder $container): void

$container->setParameter('knp_menu.default_renderer', $config['default_renderer']);

// Register autoconfiguration rules for Symfony DI 3.3+
if (\method_exists($container, 'registerForAutoconfiguration')) {
$container->registerForAutoconfiguration(VoterInterface::class)
->addTag('knp_menu.voter');
}
$container->registerForAutoconfiguration(VoterInterface::class)
->addTag('knp_menu.voter');
$container->registerForAutoconfiguration(ExtensionInterface::class)
->addTag('knp_menu.factory_extension');
}

/**
Expand Down