Skip to content

Commit

Permalink
Disallow EasyAdminBundle 4.5.2 because of Enum support
Browse files Browse the repository at this point in the history
  • Loading branch information
dragosprotung committed Feb 9, 2023
1 parent aee5a11 commit f78e11e
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 2 deletions.
5 changes: 4 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"php": "~8.1.0 || ~8.2.0",
"ext-dom": "*",
"azjezz/psl": "^2.3.1",
"easycorp/easyadmin-bundle": "~4.5.2",
"easycorp/easyadmin-bundle": "~4.5.1",
"symfony/asset": "^5.4 || ^6.2",
"symfony/cache": "^5.4 || ^6.2",
"symfony/config": "^5.4 || ^6.2",
Expand All @@ -54,6 +54,9 @@
"speicher210/functional-test-bundle": "^2.x-dev",
"vimeo/psalm": "^5.6"
},
"conflict": {
"easycorp/easyadmin-bundle": ">=4.5.2"
},
"suggest": {
"speicher210/functional-test-bundle": "For testing support."
},
Expand Down
25 changes: 25 additions & 0 deletions src/DependencyInjection/CompilerPass/EasyAdminMenuItemMatcher.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

declare(strict_types=1);

namespace Protung\EasyAdminPlusBundle\DependencyInjection\CompilerPass;

use EasyCorp\Bundle\EasyAdminBundle\Factory\MenuFactory;
use EasyCorp\Bundle\EasyAdminBundle\Menu\MenuItemMatcherInterface;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;

/**
* @see https://github.com/EasyCorp/EasyAdminBundle/pull/5620
*
* @codeCoverageIgnore
*/
final class EasyAdminMenuItemMatcher implements CompilerPassInterface
{
public function process(ContainerBuilder $container): void
{
$serviceDefinition = $container->getDefinition(MenuFactory::class);
$serviceDefinition->setArgument(4, new Reference(MenuItemMatcherInterface::class));
}
}
6 changes: 6 additions & 0 deletions src/ProtungEasyAdminPlusBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,14 @@

namespace Protung\EasyAdminPlusBundle;

use Protung\EasyAdminPlusBundle\DependencyInjection\CompilerPass\EasyAdminMenuItemMatcher;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Bundle\Bundle;

final class ProtungEasyAdminPlusBundle extends Bundle
{
public function build(ContainerBuilder $container): void
{
$container->addCompilerPass(new EasyAdminMenuItemMatcher());
}
}
5 changes: 4 additions & 1 deletion src/Resources/config/services.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,16 @@

use EasyCorp\Bundle\EasyAdminBundle\Contracts\Field\FieldConfiguratorInterface;
use EasyCorp\Bundle\EasyAdminBundle\DependencyInjection\EasyAdminExtension;
use EasyCorp\Bundle\EasyAdminBundle\Menu\MenuItemMatcher;
use EasyCorp\Bundle\EasyAdminBundle\Menu\MenuItemMatcherInterface;
use Symfony\Component\Form\FormTypeInterface;

return static function (ContainerConfigurator $container): void {
$services = $container->services()
->defaults()->private()->autowire()
->instanceof(FieldConfiguratorInterface::class)->tag(EasyAdminExtension::TAG_FIELD_CONFIGURATOR)
->instanceof(FormTypeInterface::class)->tag('form.type');
->instanceof(FormTypeInterface::class)->tag('form.type')
->alias(MenuItemMatcherInterface::class, MenuItemMatcher::class);

$services
->load('Protung\\EasyAdminPlusBundle\\', '../../../src/*')
Expand Down

0 comments on commit f78e11e

Please sign in to comment.