diff --git a/CHANGELOG.md b/CHANGELOG.md index d61720b49..f88a6f7e0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,8 @@ **Merged pull requests:** +- Dev [\#175](https://github.com/BitBagCommerce/SyliusCmsPlugin/pull/175) ([bitbager](https://github.com/bitbager)) +- Dev [\#174](https://github.com/BitBagCommerce/SyliusCmsPlugin/pull/174) ([bitbager](https://github.com/bitbager)) - Prepare 2.0.0 release [\#172](https://github.com/BitBagCommerce/SyliusCmsPlugin/pull/172) ([bitbager](https://github.com/bitbager)) ## [v2.0.0-rc.2](https://github.com/BitBagCommerce/SyliusCmsPlugin/tree/v2.0.0-rc.2) (2018-07-13) diff --git a/spec/Entity/MediaSpec.php b/spec/Entity/MediaSpec.php index 5e1e6a6f3..804c38922 100755 --- a/spec/Entity/MediaSpec.php +++ b/spec/Entity/MediaSpec.php @@ -16,6 +16,7 @@ use BitBag\SyliusCmsPlugin\Entity\MediaInterface; use BitBag\SyliusCmsPlugin\Entity\SectionInterface; use PhpSpec\ObjectBehavior; +use Sylius\Component\Core\Model\ChannelInterface; use Sylius\Component\Core\Model\ProductInterface; use Sylius\Component\Resource\Model\ResourceInterface; use Symfony\Component\HttpFoundation\File\File; @@ -87,4 +88,16 @@ function it_associates_sections(SectionInterface $firstSection, SectionInterface $this->hasSection($firstSection)->shouldReturn(false); } + + function it_associates_channels(ChannelInterface $firstChannel, ChannelInterface $secondChannel): void + { + $this->addChannel($firstChannel); + $this->hasChannel($firstChannel)->shouldReturn(true); + + $this->hasChannel($secondChannel)->shouldReturn(false); + + $this->removeChannel($firstChannel); + + $this->hasChannel($firstChannel)->shouldReturn(false); + } } diff --git a/spec/Entity/SectionSpec.php b/spec/Entity/SectionSpec.php index aaab9d092..fe340f9a0 100755 --- a/spec/Entity/SectionSpec.php +++ b/spec/Entity/SectionSpec.php @@ -40,16 +40,4 @@ function it_allows_access_via_properties(): void $this->setCode('blog'); $this->getCode()->shouldReturn('blog'); } - - function it_associates_channels(ChannelInterface $firstChannel, ChannelInterface $secondChannel): void - { - $this->addChannel($firstChannel); - $this->hasChannel($firstChannel)->shouldReturn(true); - - $this->hasChannel($secondChannel)->shouldReturn(false); - - $this->removeChannel($firstChannel); - - $this->hasChannel($firstChannel)->shouldReturn(false); - } } diff --git a/src/Controller/Action/Admin/ImportDataAction.php b/src/Controller/Action/Admin/ImportDataAction.php index b39baba9e..f3b49b4b2 100644 --- a/src/Controller/Action/Admin/ImportDataAction.php +++ b/src/Controller/Action/Admin/ImportDataAction.php @@ -23,7 +23,7 @@ use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpFoundation\Session\Session; +use Symfony\Component\HttpFoundation\Session\Flash\FlashBagInterface; use Symfony\Component\Translation\TranslatorInterface; final class ImportDataAction @@ -34,8 +34,8 @@ final class ImportDataAction /** @var FormFactoryInterface */ private $formFactory; - /** @var Session */ - private $session; + /** @var FlashBagInterface */ + private $flashBag; /** @var TranslatorInterface */ private $translator; @@ -46,13 +46,13 @@ final class ImportDataAction public function __construct( ImportProcessorInterface $importProcessor, FormFactoryInterface $formFactory, - Session $session, + FlashBagInterface $flashBag, TranslatorInterface $translator, ViewHandler $viewHandler ) { $this->importProcessor = $importProcessor; $this->formFactory = $formFactory; - $this->session = $session; + $this->flashBag = $flashBag; $this->translator = $translator; $this->viewHandler = $viewHandler; } @@ -65,7 +65,6 @@ public function __invoke(Request $request): Response $form->handleRequest($request); if ($request->isMethod('POST') && $form->isSubmitted()) { - $flashBag = $this->session->getFlashBag(); if ($form->isValid()) { /** @var UploadedFile $file */ @@ -75,12 +74,12 @@ public function __invoke(Request $request): Response try { $this->importProcessor->process($resourceName, $file->getPathname()); - $flashBag->set('success', $this->translator->trans('bitbag_sylius_cms_plugin.ui.successfully_imported')); + $this->flashBag->set('success', $this->translator->trans('bitbag_sylius_cms_plugin.ui.successfully_imported')); } catch (ImportFailedException $exception) { - $flashBag->set('error', $exception->getMessage()); + $this->flashBag->set('error', $exception->getMessage()); } } else { - $flashBag->set('error', rtrim(implode($this->getFormErrors($form), ', '), ', ')); + $this->flashBag->set('error', rtrim(implode($this->getFormErrors($form), ', '), ', ')); } return new RedirectResponse($referer); diff --git a/src/Downloader/ImageDownloader.php b/src/Downloader/ImageDownloader.php index cf3b1c85f..c3fdc5e73 100644 --- a/src/Downloader/ImageDownloader.php +++ b/src/Downloader/ImageDownloader.php @@ -29,8 +29,8 @@ public function download(string $url): File { $pathInfo = pathinfo($url); $extension = $pathInfo['extension']; - $path = sys_get_temp_dir() . md5(random_bytes(10)) . '.' . $extension; + $this->filesystem->dumpFile($path, file_get_contents($url)); return new File($path); diff --git a/src/Entity/Media.php b/src/Entity/Media.php index 146b0c6ba..359927744 100644 --- a/src/Entity/Media.php +++ b/src/Entity/Media.php @@ -22,6 +22,7 @@ class Media implements MediaInterface use ToggleableTrait; use SectionableTrait; use ProductsAwareTrait; + use ChannelsAwareTrait; use TranslatableTrait { __construct as protected initializeTranslationsCollection; } @@ -52,6 +53,7 @@ public function __construct() $this->initializeTranslationsCollection(); $this->initializeSectionsCollection(); $this->initializeProductsCollection(); + $this->initializeChannelsCollection(); } public function getId(): ?int diff --git a/src/Entity/MediaInterface.php b/src/Entity/MediaInterface.php index f93df3760..a1d502c4c 100644 --- a/src/Entity/MediaInterface.php +++ b/src/Entity/MediaInterface.php @@ -12,6 +12,7 @@ namespace BitBag\SyliusCmsPlugin\Entity; +use Sylius\Component\Channel\Model\ChannelsAwareInterface; use Sylius\Component\Resource\Model\ResourceInterface; use Sylius\Component\Resource\Model\ToggleableInterface; use Sylius\Component\Resource\Model\TranslatableInterface; @@ -22,7 +23,8 @@ interface MediaInterface extends TranslatableInterface, ToggleableInterface, ProductsAwareInterface, - SectionableInterface + SectionableInterface, + ChannelsAwareInterface { public const IMAGE_TYPE = 'image'; public const VIDEO_TYPE = 'video'; diff --git a/src/Entity/Section.php b/src/Entity/Section.php index 5902087c5..0a7382429 100755 --- a/src/Entity/Section.php +++ b/src/Entity/Section.php @@ -17,7 +17,6 @@ class Section implements SectionInterface { - use ChannelsAwareTrait; use TranslatableTrait { __construct as private initializeTranslationsCollection; } @@ -31,7 +30,6 @@ class Section implements SectionInterface public function __construct() { $this->initializeTranslationsCollection(); - $this->initializeChannelsCollection(); } public function getId(): ?int diff --git a/src/Entity/SectionInterface.php b/src/Entity/SectionInterface.php index cfdd05b75..31f252a81 100755 --- a/src/Entity/SectionInterface.php +++ b/src/Entity/SectionInterface.php @@ -16,7 +16,7 @@ use Sylius\Component\Resource\Model\ResourceInterface; use Sylius\Component\Resource\Model\TranslatableInterface; -interface SectionInterface extends ResourceInterface, TranslatableInterface, ChannelsAwareInterface +interface SectionInterface extends ResourceInterface, TranslatableInterface { public function getCode(): ?string; diff --git a/src/Fixture/Factory/MediaFixtureFactory.php b/src/Fixture/Factory/MediaFixtureFactory.php index 813d8c947..78cb6a705 100644 --- a/src/Fixture/Factory/MediaFixtureFactory.php +++ b/src/Fixture/Factory/MediaFixtureFactory.php @@ -19,6 +19,7 @@ use BitBag\SyliusCmsPlugin\MediaProvider\ProviderInterface; use BitBag\SyliusCmsPlugin\Repository\MediaRepositoryInterface; use BitBag\SyliusCmsPlugin\Resolver\MediaProviderResolverInterface; +use Sylius\Component\Channel\Context\ChannelContextInterface; use Sylius\Component\Resource\Factory\FactoryInterface; use Symfony\Component\HttpFoundation\File\File; @@ -30,6 +31,9 @@ final class MediaFixtureFactory implements FixtureFactoryInterface /** @var FactoryInterface */ private $mediaTranslationFactory; + /** @var ChannelContextInterface */ + private $channelContext; + /** @var MediaProviderResolverInterface */ private $mediaProviderResolver; @@ -45,6 +49,7 @@ final class MediaFixtureFactory implements FixtureFactoryInterface public function __construct( FactoryInterface $mediaFactory, FactoryInterface $mediaTranslationFactory, + ChannelContextInterface $channelContext, MediaProviderResolverInterface $mediaProviderResolver, MediaRepositoryInterface $mediaRepository, ProductsAssignerInterface $productsAssigner, @@ -52,6 +57,7 @@ public function __construct( ) { $this->mediaFactory = $mediaFactory; $this->mediaTranslationFactory = $mediaTranslationFactory; + $this->channelContext = $channelContext; $this->mediaProviderResolver = $mediaProviderResolver; $this->mediaRepository = $mediaRepository; $this->productsAssigner = $productsAssigner; @@ -86,6 +92,7 @@ private function createMedia(string $code, array $mediaData): void $media->setCode($code); $media->setEnabled($mediaData['enabled']); $media->setFile(new File($mediaData['path'])); + $media->addChannel($this->channelContext->getChannel()); $this->mediaProviderResolver->resolveProvider($media)->upload($media); diff --git a/src/Fixture/Factory/SectionFixtureFactory.php b/src/Fixture/Factory/SectionFixtureFactory.php index d747e3970..5220cff93 100755 --- a/src/Fixture/Factory/SectionFixtureFactory.php +++ b/src/Fixture/Factory/SectionFixtureFactory.php @@ -15,7 +15,6 @@ use BitBag\SyliusCmsPlugin\Entity\SectionInterface; use BitBag\SyliusCmsPlugin\Entity\SectionTranslationInterface; use BitBag\SyliusCmsPlugin\Repository\SectionRepositoryInterface; -use Sylius\Component\Channel\Context\ChannelContextInterface; use Sylius\Component\Resource\Factory\FactoryInterface; final class SectionFixtureFactory implements FixtureFactoryInterface @@ -29,19 +28,14 @@ final class SectionFixtureFactory implements FixtureFactoryInterface /** @var SectionRepositoryInterface */ private $sectionRepository; - /** @var ChannelContextInterface */ - private $channelContext; - public function __construct( FactoryInterface $sectionFactory, FactoryInterface $sectionTranslationFactory, - SectionRepositoryInterface $sectionRepository, - ChannelContextInterface $channelContext + SectionRepositoryInterface $sectionRepository ) { $this->sectionFactory = $sectionFactory; $this->sectionTranslationFactory = $sectionTranslationFactory; $this->sectionRepository = $sectionRepository; - $this->channelContext = $channelContext; } public function load(array $data): void @@ -58,7 +52,6 @@ public function load(array $data): void $section = $this->sectionFactory->createNew(); $section->setCode($code); - $section->addChannel($this->channelContext->getChannel()); foreach ($fields['translations'] as $localeCode => $translation) { /** @var SectionTranslationInterface $sectionTranslation */ diff --git a/src/Form/Type/MediaType.php b/src/Form/Type/MediaType.php index fe4d18d21..337d09b8e 100644 --- a/src/Form/Type/MediaType.php +++ b/src/Form/Type/MediaType.php @@ -13,6 +13,7 @@ namespace BitBag\SyliusCmsPlugin\Form\Type; use BitBag\SyliusCmsPlugin\Form\Type\Translation\MediaTranslationType; +use Sylius\Bundle\ChannelBundle\Form\Type\ChannelChoiceType; use Sylius\Bundle\ProductBundle\Form\Type\ProductAutocompleteChoiceType; use Sylius\Bundle\ResourceBundle\Form\Type\AbstractResourceType; use Sylius\Bundle\ResourceBundle\Form\Type\ResourceTranslationsType; @@ -59,6 +60,12 @@ public function buildForm(FormBuilderInterface $builder, array $options): void 'label' => 'bitbag_sylius_cms_plugin.ui.products', 'multiple' => true, ]) + ->add('channels', ChannelChoiceType::class, [ + 'label' => 'bitbag_sylius_cms_plugin.ui.channels', + 'required' => false, + 'multiple' => true, + 'expanded' => true, + ]) ->add('translations', ResourceTranslationsType::class, [ 'entry_type' => MediaTranslationType::class, ]) diff --git a/src/Form/Type/SectionType.php b/src/Form/Type/SectionType.php index 180b0ba3b..ae9868474 100755 --- a/src/Form/Type/SectionType.php +++ b/src/Form/Type/SectionType.php @@ -31,11 +31,6 @@ public function buildForm(FormBuilderInterface $builder, array $options): void ->add('translations', ResourceTranslationsType::class, [ 'entry_type' => SectionTranslationType::class, ]) - ->add('channels', ChannelChoiceType::class, [ - 'multiple' => true, - 'expanded' => true, - 'label' => 'bitbag_sylius_cms_plugin.ui.channels', - ]) ; } diff --git a/src/Repository/MediaRepository.php b/src/Repository/MediaRepository.php index a67937cd2..a8c50e8a4 100755 --- a/src/Repository/MediaRepository.php +++ b/src/Repository/MediaRepository.php @@ -25,9 +25,10 @@ public function createListQueryBuilder(): QueryBuilder ; } - public function findOneEnabledByCode(string $code): ?MediaInterface + public function findOneEnabledByCode(string $code, string $channelCode): ?MediaInterface { return $this->createQueryBuilder('o') + ->innerJoin('o.channels', 'channel') ->where('o.code = :code') ->andWhere('o.enabled = true') ->setParameter('code', $code) @@ -36,30 +37,30 @@ public function findOneEnabledByCode(string $code): ?MediaInterface ; } - public function findBySectionCode(string $sectionCode, string $localeCode): array + public function findBySectionCode(string $sectionCode, string $channelCode): array { return $this->createQueryBuilder('o') - ->leftJoin('o.translations', 'translation') + ->innerJoin('o.channels', 'channel') ->innerJoin('o.sections', 'section') - ->andWhere('translation.locale = :localeCode') + ->where('channel.code = :channelCode') ->andWhere('section.code = :sectionCode') ->andWhere('o.enabled = true') - ->setParameter('localeCode', $localeCode) + ->setParameter('channelCode', $channelCode) ->setParameter('sectionCode', $sectionCode) ->getQuery() ->getResult() ; } - public function findByProductCode(string $productCode, string $localeCode): array + public function findByProductCode(string $productCode, string $channelCode): array { return $this->createQueryBuilder('o') - ->leftJoin('o.translations', 'translation') + ->innerJoin('o.channels', 'channel') ->innerJoin('o.products', 'product') - ->andWhere('translation.locale = :localeCode') + ->where('channel.code = :channelCode') ->andWhere('product.code = :productCode') ->andWhere('o.enabled = true') - ->setParameter('localeCode', $localeCode) + ->setParameter('channelCode', $channelCode) ->setParameter('productCode', $productCode) ->getQuery() ->getResult() diff --git a/src/Repository/MediaRepositoryInterface.php b/src/Repository/MediaRepositoryInterface.php index ca943f122..5ee619171 100755 --- a/src/Repository/MediaRepositoryInterface.php +++ b/src/Repository/MediaRepositoryInterface.php @@ -20,9 +20,9 @@ interface MediaRepositoryInterface extends RepositoryInterface { public function createListQueryBuilder(): QueryBuilder; - public function findOneEnabledByCode(string $code): ?MediaInterface; + public function findOneEnabledByCode(string $code, string $channelCode): ?MediaInterface; - public function findBySectionCode(string $sectionCode, string $localeCode): array; + public function findBySectionCode(string $sectionCode, string $channelCode): array; - public function findByProductCode(string $productCode, string $localeCode): array; + public function findByProductCode(string $productCode, string $channelCode): array; } diff --git a/src/Repository/SectionRepository.php b/src/Repository/SectionRepository.php index b78ea0df0..de6d546ee 100755 --- a/src/Repository/SectionRepository.php +++ b/src/Repository/SectionRepository.php @@ -52,17 +52,14 @@ private function createTranslationBasedQueryBuilder(?string $locale = null): Que return $queryBuilder; } - public function findOneByCode(string $code, ?string $localeCode, string $channelCode): ?SectionInterface + public function findOneByCode(string $code, ?string $localeCode): ?SectionInterface { return $this->createQueryBuilder('o') ->leftJoin('o.translations', 'translation') - ->innerJoin('o.channels', 'channels') ->where('translation.locale = :localeCode') ->andWhere('o.code = :code') - ->andWhere('channels.code = :channelCode') ->setParameter('code', $code) ->setParameter('localeCode', $localeCode) - ->setParameter('channelCode', $channelCode) ->getQuery() ->getOneOrNullResult() ; diff --git a/src/Repository/SectionRepositoryInterface.php b/src/Repository/SectionRepositoryInterface.php index 2a6d9eb8d..7654f38ed 100755 --- a/src/Repository/SectionRepositoryInterface.php +++ b/src/Repository/SectionRepositoryInterface.php @@ -22,5 +22,5 @@ public function createListQueryBuilder(): QueryBuilder; public function findByNamePart(string $phrase, ?string $locale = null): array; - public function findOneByCode(string $code, ?string $localeCode, string $channelCode): ?SectionInterface; + public function findOneByCode(string $code, ?string $localeCode): ?SectionInterface; } diff --git a/src/Resolver/MediaResourceResolver.php b/src/Resolver/MediaResourceResolver.php index 73d01a924..03af509d9 100755 --- a/src/Resolver/MediaResourceResolver.php +++ b/src/Resolver/MediaResourceResolver.php @@ -15,24 +15,33 @@ use BitBag\SyliusCmsPlugin\Entity\MediaInterface; use BitBag\SyliusCmsPlugin\Repository\MediaRepositoryInterface; use Psr\Log\LoggerInterface; +use Sylius\Component\Channel\Context\ChannelContextInterface; final class MediaResourceResolver implements MediaResourceResolverInterface { /** @var MediaRepositoryInterface */ private $mediaRepository; + /** @var ChannelContextInterface */ + private $channelContext; + /** @var LoggerInterface */ private $logger; - public function __construct(MediaRepositoryInterface $mediaRepository, LoggerInterface $logger) + public function __construct( + MediaRepositoryInterface $mediaRepository, + ChannelContextInterface $channelContext, + LoggerInterface $logger + ) { $this->mediaRepository = $mediaRepository; + $this->channelContext = $channelContext; $this->logger = $logger; } public function findOrLog(string $code): ?MediaInterface { - $media = $this->mediaRepository->findOneEnabledByCode($code); + $media = $this->mediaRepository->findOneEnabledByCode($code, $this->channelContext->getChannel()->getCode()); if (false === $media instanceof MediaInterface) { $this->logger->warning(sprintf( diff --git a/src/Resources/config/doctrine/Block.orm.yml b/src/Resources/config/doctrine/Block.orm.yml index 0c649535d..fd444b1be 100755 --- a/src/Resources/config/doctrine/Block.orm.yml +++ b/src/Resources/config/doctrine/Block.orm.yml @@ -39,7 +39,6 @@ BitBag\SyliusCmsPlugin\Entity\Block: product_id: referencedColumnName: id onDelete: CASCADE - channels: targetEntity: Sylius\Component\Channel\Model\ChannelInterface joinTable: diff --git a/src/Resources/config/doctrine/Media.orm.yml b/src/Resources/config/doctrine/Media.orm.yml index ce1f95c6a..0dcf0d4b1 100644 --- a/src/Resources/config/doctrine/Media.orm.yml +++ b/src/Resources/config/doctrine/Media.orm.yml @@ -53,3 +53,14 @@ BitBag\SyliusCmsPlugin\Entity\Media: product_id: referencedColumnName: id onDelete: CASCADE + channels: + targetEntity: Sylius\Component\Channel\Model\ChannelInterface + joinTable: + name: bitbag_cms_media_channels + joinColumns: + block_id: + referencedColumnName: id + inverseJoinColumns: + channel_id: + referencedColumnName: id + onDelete: CASCADE diff --git a/src/Resources/config/doctrine/Page.orm.yml b/src/Resources/config/doctrine/Page.orm.yml index f9126a3b6..da0bca975 100755 --- a/src/Resources/config/doctrine/Page.orm.yml +++ b/src/Resources/config/doctrine/Page.orm.yml @@ -53,7 +53,6 @@ BitBag\SyliusCmsPlugin\Entity\Page: section_id: referencedColumnName: id onDelete: CASCADE - channels: targetEntity: Sylius\Component\Channel\Model\ChannelInterface joinTable: diff --git a/src/Resources/config/doctrine/Section.orm.yml b/src/Resources/config/doctrine/Section.orm.yml index c8478376c..18eecc36f 100755 --- a/src/Resources/config/doctrine/Section.orm.yml +++ b/src/Resources/config/doctrine/Section.orm.yml @@ -13,15 +13,3 @@ BitBag\SyliusCmsPlugin\Entity\Section: type: string length: 250 unique: true - manyToMany: - channels: - targetEntity: Sylius\Component\Channel\Model\ChannelInterface - joinTable: - name: bitbag_cms_section_channels - joinColumns: - faq_id: - referencedColumnName: id - inverseJoinColumns: - channel_id: - referencedColumnName: id - onDelete: CASCADE diff --git a/src/Resources/config/routing/shop/media.yml b/src/Resources/config/routing/shop/media.yml index 4e264be86..932815dee 100755 --- a/src/Resources/config/routing/shop/media.yml +++ b/src/Resources/config/routing/shop/media.yml @@ -8,6 +8,7 @@ bitbag_sylius_cms_plugin_shop_media_render: method: findOneByCode arguments: - $code + - "expr:service('sylius.context.channel').getChannel().getCode()" bitbag_sylius_cms_plugin_shop_media_download: path: /media/download/{code} @@ -26,7 +27,7 @@ bitbag_sylius_cms_plugin_shop_media_index_by_section_code: method: findBySectionCode arguments: - $sectionCode - - "expr:service('sylius.context.locale').getLocaleCode()" + - "expr:service('sylius.context.channel').getChannel().getCode()" bitbag_sylius_cms_plugin_shop_media_index_by_product_code: path: /media/product/{productCode} @@ -39,4 +40,4 @@ bitbag_sylius_cms_plugin_shop_media_index_by_product_code: method: findByProductCode arguments: - $productCode - - "expr:service('sylius.context.locale').getLocaleCode()" + - "expr:service('sylius.context.channel').getChannel().getCode()" diff --git a/src/Resources/config/routing/shop/section.yml b/src/Resources/config/routing/shop/section.yml index 034ac79b3..f3d8a2318 100755 --- a/src/Resources/config/routing/shop/section.yml +++ b/src/Resources/config/routing/shop/section.yml @@ -10,4 +10,3 @@ bitbag_sylius_cms_plugin_shop_section_show: arguments: - $code - "expr:service('sylius.context.locale').getLocaleCode()" - - "expr:service('sylius.context.channel').getChannel().getCode()" diff --git a/src/Resources/config/services/controller.yml b/src/Resources/config/services/controller.yml index 6ea20c13b..02a9e9bbf 100755 --- a/src/Resources/config/services/controller.yml +++ b/src/Resources/config/services/controller.yml @@ -18,7 +18,7 @@ services: arguments: - "@bitbag_sylius_cms_plugin.processor.import" - "@form.factory" - - "@session" + - "@session.flash_bag" - "@translator" - "@fos_rest.view_handler.default" diff --git a/src/Resources/config/services/fixture.yml b/src/Resources/config/services/fixture.yml index 506257725..1a094c2ee 100755 --- a/src/Resources/config/services/fixture.yml +++ b/src/Resources/config/services/fixture.yml @@ -71,13 +71,13 @@ services: - "@bitbag_sylius_cms_plugin.factory.section" - "@bitbag_sylius_cms_plugin.factory.section_translation" - "@bitbag_sylius_cms_plugin.repository.section" - - "@sylius.context.channel" bitbag_sylius_cms_plugin.fixture.factory.media: class: BitBag\SyliusCmsPlugin\Fixture\Factory\MediaFixtureFactory arguments: - "@bitbag_sylius_cms_plugin.factory.media" - "@bitbag_sylius_cms_plugin.factory.media_translation" + - "@sylius.context.channel" - "@bitbag_sylius_cms_plugin.resolver.media_provider" - "@bitbag_sylius_cms_plugin.repository.media" - "@bitbag_sylius_cms_plugin.assigner.products" diff --git a/src/Resources/config/services/resolver.yml b/src/Resources/config/services/resolver.yml index 6325fe6d2..ec11d803c 100644 --- a/src/Resources/config/services/resolver.yml +++ b/src/Resources/config/services/resolver.yml @@ -51,6 +51,7 @@ services: public: true arguments: - "@bitbag_sylius_cms_plugin.repository.media" + - "@sylius.context.channel" - "@logger" bitbag_sylius_cms_plugin.resolver.media_provider: diff --git a/src/Resources/views/Media/Crud/_form.html.twig b/src/Resources/views/Media/Crud/_form.html.twig index 6dc9e495a..fe65c8cb6 100755 --- a/src/Resources/views/Media/Crud/_form.html.twig +++ b/src/Resources/views/Media/Crud/_form.html.twig @@ -12,6 +12,7 @@ {{ form_row(form.enabled) }} {{ form_row(form.products) }} {{ form_row(form.sections) }} + {{ form_row(form.channels) }} diff --git a/src/Resources/views/Section/Crud/_form.html.twig b/src/Resources/views/Section/Crud/_form.html.twig index ab4ce6e4f..401fc20c0 100755 --- a/src/Resources/views/Section/Crud/_form.html.twig +++ b/src/Resources/views/Section/Crud/_form.html.twig @@ -6,7 +6,6 @@