diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 46aa0f9..6bba3ca 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -150,7 +150,7 @@ jobs:
run: vendor/bin/behat --colors --strict -vvv --no-interaction || vendor/bin/behat --colors --strict -vvv --no-interaction --rerun
- name: Upload Behat logs
- uses: actions/upload-artifact@v3
+ uses: actions/upload-artifact@v4
if: failure()
with:
name: Behat logs
diff --git a/phpstan.neon b/phpstan.neon
index f7eee75..9bd7de4 100644
--- a/phpstan.neon
+++ b/phpstan.neon
@@ -13,3 +13,4 @@ parameters:
ignoreErrors:
- '/Parameter #1 \$configuration of method Symfony\\Component\\DependencyInjection\\Extension\\Extension::processConfiguration\(\) expects Symfony\\Component\\Config\\Definition\\ConfigurationInterface, Symfony\\Component\\Config\\Definition\\ConfigurationInterface\|null given\./'
+ - '#Call to an undefined method Symfony\\Component\\Config\\Definition\\Builder\\NodeDefinition::children\(\).#'
diff --git a/src/Fixture/BannerSectionFixture.php b/src/Fixture/BannerSectionFixture.php
new file mode 100755
index 0000000..9ae043c
--- /dev/null
+++ b/src/Fixture/BannerSectionFixture.php
@@ -0,0 +1,76 @@
+factory->load($options['sections']);
+ }
+
+ public function getName(): string
+ {
+ return 'banner_section';
+ }
+
+ protected function configureOptionsNode(ArrayNodeDefinition $optionsNode): void
+ {
+ $optionsNode
+ ->children()
+ ->arrayNode('sections')
+ ->prototype('array')
+ ->children()
+ ->scalarNode('name')->isRequired()->cannotBeEmpty()->end()
+ ->scalarNode('code')->isRequired()->cannotBeEmpty()->end()
+ ->integerNode('width')->defaultNull()->end()
+ ->integerNode('height')->defaultNull()->end()
+ ->arrayNode('banners')
+ ->prototype('array')
+ ->children()
+ ->scalarNode('path')->isRequired()->cannotBeEmpty()->end()
+ ->scalarNode('alt')->defaultNull()->end()
+ ->scalarNode('filename')->isRequired()->cannotBeEmpty()->end()
+ ->scalarNode('link')->defaultNull()->end()
+ ->integerNode('priority')->isRequired()->end()
+ ->integerNode('clicks')->defaultValue(0)->end()
+ ->scalarNode('locale')->isRequired()->cannotBeEmpty()->end()
+ ->arrayNode('ads')
+ ->prototype('array')
+ ->children()
+ ->scalarNode('name')->isRequired()->cannotBeEmpty()->end()
+ ->booleanNode('enabled')->isRequired()->end()
+ ->scalarNode('startAt')->isRequired()->cannotBeEmpty()->end()
+ ->scalarNode('endAt')->isRequired()->cannotBeEmpty()->end()
+ ->integerNode('priority')->isRequired()->end()
+ ->scalarNode('code')->isRequired()->cannotBeEmpty()->end()
+ ->end()
+ ->end()
+ ->end()
+ ->end()
+ ->end()
+ ->end()
+ ->end()
+ ->end()
+ ->end()
+ ->end()
+ ;
+ }
+}
diff --git a/src/Fixture/Factory/BannerSectionFixtureFactory.php b/src/Fixture/Factory/BannerSectionFixtureFactory.php
new file mode 100755
index 0000000..7e68208
--- /dev/null
+++ b/src/Fixture/Factory/BannerSectionFixtureFactory.php
@@ -0,0 +1,98 @@
+sectionFactory->createNew();
+
+ $section->setCode($fields['code']);
+ $section->setName($fields['name']);
+ $section->setHeight($fields['height']);
+ $section->setWidth($fields['width']);
+
+ $this->sectionRepository->add($section);
+
+ if (($fields['banners'] ?? false) && is_array($fields['banners'])) {
+ foreach ($fields['banners'] as $bannerData) {
+ /** @var BannerInterface $banner */
+ $banner = $this->bannerFactory->createNew();
+
+ $banner->setPath($bannerData['path']);
+ $banner->setAlt($bannerData['alt'] ?? null);
+ $banner->setFileName($bannerData['filename']);
+ $banner->setLink($bannerData['link'] ?? null);
+ $banner->setPriority($bannerData['priority']);
+ $banner->setClicks($bannerData['clicks'] ?? 0);
+
+ /** @var ?LocaleInterface $locale */
+ $locale = $this->localeRepository->findOneBy(['code' => $bannerData['locale']]);
+
+ if (null === $locale) {
+ throw new \Exception(sprintf('Locale with code "%s" not found', $bannerData['locale']));
+ }
+
+ $banner->setLocale($locale);
+
+ $this->bannerRepository->add($banner);
+
+ if (isset($bannerData['ads']) && is_array($bannerData['ads'])) {
+ foreach ($bannerData['ads'] as $adData) {
+ /** @var AdInterface $ad */
+ $ad = $this->adFactory->createNew();
+
+ $ad->setName($adData['name']);
+ $ad->setEnabled($adData['enabled']);
+ $ad->setStartAt(new \DateTime($adData['startAt']));
+ $ad->setEndAt(new \DateTime($adData['endAt']));
+ $ad->setPriority($adData['priority']);
+ $ad->setCode($adData['code']);
+
+ $this->adRepository->add($ad);
+
+ $banner->addAds($ad);
+ }
+ }
+
+ $banner->setSection($section);
+
+ $this->bannerRepository->add($banner);
+ }
+ }
+ }
+ }
+}
diff --git a/src/Fixture/Factory/FixtureFactoryInterface.php b/src/Fixture/Factory/FixtureFactoryInterface.php
new file mode 100755
index 0000000..37095ae
--- /dev/null
+++ b/src/Fixture/Factory/FixtureFactoryInterface.php
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/Resources/config/services/fixture/fixtures_factories.xml b/src/Resources/config/services/fixture/fixtures_factories.xml
new file mode 100644
index 0000000..60f64f6
--- /dev/null
+++ b/src/Resources/config/services/fixture/fixtures_factories.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+