Skip to content

Commit

Permalink
Merge pull request #39 from lanfisis/master
Browse files Browse the repository at this point in the history
Add Sylius Plus compatibility plugin
  • Loading branch information
lanfisis authored Mar 27, 2024
2 parents 204fc9a + 4ba8a62 commit 8a71322
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
12 changes: 12 additions & 0 deletions src/DependencyInjection/MonsieurBizSyliusHomepageExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -21,6 +23,8 @@

final class MonsieurBizSyliusHomepageExtension extends Extension implements PrependExtensionInterface
{
use SyliusPlusCompatibilityTrait;

/**
* @inheritdoc
*/
Expand All @@ -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]);
}

/**
Expand All @@ -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')"
);
}
}
6 changes: 6 additions & 0 deletions symfony.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down Expand Up @@ -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"
},
Expand Down

0 comments on commit 8a71322

Please sign in to comment.