Skip to content

Commit

Permalink
OP-525: Change helper to factory
Browse files Browse the repository at this point in the history
  • Loading branch information
jkindly committed Sep 24, 2024
1 parent 4252179 commit c8dc43a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

declare(strict_types=1);

namespace Sylius\CmsPlugin\Helper;
namespace Sylius\CmsPlugin\Factory;

use Sylius\CmsPlugin\Entity\ContentConfiguration;

final class ContentElementHelper
final class ContentElementFactory
{
public static function createHeadingContentElement(
?string $locale,
Expand Down
10 changes: 5 additions & 5 deletions src/Importer/Legacy/LegacyBlockImporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace Sylius\CmsPlugin\Importer\Legacy;

use Sylius\CmsPlugin\Entity\BlockInterface;
use Sylius\CmsPlugin\Helper\ContentElementHelper;
use Sylius\CmsPlugin\Factory\ContentElementFactory;
use Sylius\CmsPlugin\Importer\AbstractImporter;
use Sylius\CmsPlugin\Repository\BlockRepositoryInterface;
use Sylius\CmsPlugin\Resolver\Importer\ImporterChannelsResolverInterface;
Expand Down Expand Up @@ -47,7 +47,7 @@ public function import(array $row): void
$block->setName($this->getTranslatableColumnValue(self::NAME_COLUMN, $locale, $row));
}

$heading = ContentElementHelper::createHeadingContentElement(
$heading = ContentElementFactory::createHeadingContentElement(
$locale,
'h2',
$this->getTranslatableColumnValue(self::NAME_COLUMN, $locale, $row),
Expand All @@ -57,7 +57,7 @@ public function import(array $row): void
$block->addContentElement($heading);
}

$singleMedia = ContentElementHelper::createSingleMediaContentElement(
$singleMedia = ContentElementFactory::createSingleMediaContentElement(
$locale,
$this->getTranslatableColumnValue(self::IMAGE_COLUMN, $locale, $row),
);
Expand All @@ -66,7 +66,7 @@ public function import(array $row): void
$block->addContentElement($singleMedia);
}

$content = ContentElementHelper::createTextareaContentElement(
$content = ContentElementFactory::createTextareaContentElement(
$locale,
$this->getTranslatableColumnValue(self::CONTENT_COLUMN, $locale, $row),
);
Expand All @@ -79,7 +79,7 @@ public function import(array $row): void
$locales = $this->localeRepository->findAll();
/** @var LocaleInterface $locale */
foreach ($locales as $locale) {
$productsGrid = ContentElementHelper::createProductsGridContentElement(
$productsGrid = ContentElementFactory::createProductsGridContentElement(
$locale->getCode(),
$this->getColumnValue(self::PRODUCTS_COLUMN, $row),
);
Expand Down
10 changes: 5 additions & 5 deletions src/Importer/Legacy/LegacyPageImporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

use Doctrine\ORM\EntityManagerInterface;
use Sylius\CmsPlugin\Entity\PageInterface;
use Sylius\CmsPlugin\Helper\ContentElementHelper;
use Sylius\CmsPlugin\Factory\ContentElementFactory;
use Sylius\CmsPlugin\Importer\AbstractImporter;
use Sylius\CmsPlugin\Resolver\Importer\ImporterChannelsResolverInterface;
use Sylius\CmsPlugin\Resolver\Importer\ImporterCollectionsResolverInterface;
Expand Down Expand Up @@ -60,7 +60,7 @@ public function import(array $row): void
$page->setTeaserTitle($this->getTranslatableColumnValue(self::NAME_WHEN_LINKED_COLUMN, $locale, $row));
$page->setTeaserContent($this->getTranslatableColumnValue(self::DESCRIPTION_WHEN_LINKED_COLUMN, $locale, $row));

$heading = ContentElementHelper::createHeadingContentElement(
$heading = ContentElementFactory::createHeadingContentElement(
$locale,
'h2',
$this->getTranslatableColumnValue(self::NAME_COLUMN, $locale, $row),
Expand All @@ -70,7 +70,7 @@ public function import(array $row): void
$page->addContentElement($heading);
}

$singleMedia = ContentElementHelper::createSingleMediaContentElement(
$singleMedia = ContentElementFactory::createSingleMediaContentElement(
$locale,
$this->getTranslatableColumnValue(self::IMAGE_COLUMN, $locale, $row),
);
Expand All @@ -79,7 +79,7 @@ public function import(array $row): void
$page->addContentElement($singleMedia);
}

$content = ContentElementHelper::createTextareaContentElement(
$content = ContentElementFactory::createTextareaContentElement(
$locale,
$this->getTranslatableColumnValue(self::CONTENT_COLUMN, $locale, $row),
);
Expand All @@ -92,7 +92,7 @@ public function import(array $row): void
$locales = $this->localeRepository->findAll();
/** @var LocaleInterface $locale */
foreach ($locales as $locale) {
$productsGrid = ContentElementHelper::createProductsGridContentElement(
$productsGrid = ContentElementFactory::createProductsGridContentElement(
$locale->getCode(),
$this->getColumnValue(self::PRODUCTS_COLUMN, $row),
);
Expand Down

0 comments on commit c8dc43a

Please sign in to comment.