diff --git a/composer.json b/composer.json index 396647e..0c0beeb 100644 --- a/composer.json +++ b/composer.json @@ -8,7 +8,8 @@ "php": "~7.4|~8.0", "sylius/sylius": ">=1.8 <1.13", "gedmo/doctrine-extensions": "^2.4.12 || ^3.0", - "monsieurbiz/sylius-rich-editor-plugin": "^2.2" + "monsieurbiz/sylius-rich-editor-plugin": "^2.2", + "monsieurbiz/sylius-plus-adapter-plugin": "^1.0" }, "require-dev": { "behat/behat": "^3.6.1", diff --git a/src/DependencyInjection/MonsieurBizSyliusHomepageExtension.php b/src/DependencyInjection/MonsieurBizSyliusHomepageExtension.php index 8e07821..f267bc4 100644 --- a/src/DependencyInjection/MonsieurBizSyliusHomepageExtension.php +++ b/src/DependencyInjection/MonsieurBizSyliusHomepageExtension.php @@ -13,6 +13,8 @@ namespace MonsieurBiz\SyliusHomepagePlugin\DependencyInjection; +use MonsieurBiz\SyliusHomepagePlugin\Entity\Homepage; +use MonsieurBiz\SyliusPlusAdapterPlugin\DependencyInjection\SyliusPlusCompatibilityTrait; use Symfony\Component\Config\FileLocator; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Extension\Extension; @@ -21,6 +23,8 @@ final class MonsieurBizSyliusHomepageExtension extends Extension implements PrependExtensionInterface { + use SyliusPlusCompatibilityTrait; + /** * @inheritdoc */ @@ -29,6 +33,7 @@ public function load(array $config, ContainerBuilder $container): void $this->processConfiguration($this->getConfiguration([], $container), $config); $loader = new YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config')); $loader->load('services.yaml'); + $this->enabledFilteredChannelChoiceType($container, ['homepage' => Homepage::class]); } /** @@ -50,5 +55,12 @@ public function prepend(ContainerBuilder $container): void 'MonsieurBiz\SyliusHomepagePlugin\Migrations' => '@MonsieurBizSyliusHomepagePlugin/Migrations', ]), ]); + $this->prependRestrictedResources($container, ['homepage']); + $this->replaceInGridOriginalQueryBuilderWithChannelRestrictedQueryBuilder( + $container, + 'monsieurbiz_homepage', + '%monsieurbiz_homepage.model.homepage.class%', + "expr:service('monsieurbiz_homepage.repository.homepage').createQueryBuilder('o')" + ); } } diff --git a/symfony.lock b/symfony.lock index 0b5f92d..1e2e23e 100644 --- a/symfony.lock +++ b/symfony.lock @@ -414,6 +414,9 @@ "monolog/monolog": { "version": "2.1.1" }, + "monsieurbiz/sylius-plus-adapter-plugin": { + "version": "v1.0.0" + }, "monsieurbiz/sylius-rich-editor-plugin": { "version": "1.0", "recipe": { @@ -757,6 +760,9 @@ "sylius/admin-api-bundle": { "version": "v1.9.4" }, + "sylius/calendar": { + "version": "v0.3.0" + }, "sylius/fixtures-bundle": { "version": "v1.7.0" },