Skip to content

Commit

Permalink
Make localize value trait more generic
Browse files Browse the repository at this point in the history
  • Loading branch information
jolelievre committed Jan 9, 2024
1 parent d11bf58 commit 630e56f
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@

declare(strict_types=1);

namespace PrestaShop\PrestaShop\Adapter\Product\Update\Filler;
namespace PrestaShop\PrestaShop\Adapter\Domain;

use Product;
use ObjectModel;

trait LocalizedValueFillerTrait
trait LocalizedObjectModelTrait
{
protected function fillLocalizedValues(Product $product, string $propertyName, array $localizedValues, array &$updatableProperties): void
protected function fillLocalizedValues(ObjectModel $product, string $propertyName, array $localizedValues, array &$updatableProperties): void
{
foreach ($localizedValues as $langId => $localizedValue) {
$product->$propertyName[$langId] = $localizedValue;
Expand Down
3 changes: 2 additions & 1 deletion src/Adapter/Product/Update/Filler/BasicInformationFiller.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

namespace PrestaShop\PrestaShop\Adapter\Product\Update\Filler;

use PrestaShop\PrestaShop\Adapter\Domain\LocalizedObjectModelTrait;
use PrestaShop\PrestaShop\Core\Domain\Product\Command\UpdateProductCommand;
use Product;

Expand All @@ -35,7 +36,7 @@
*/
class BasicInformationFiller implements ProductFillerInterface
{
use LocalizedValueFillerTrait;
use LocalizedObjectModelTrait;

/**
* @var int
Expand Down
3 changes: 2 additions & 1 deletion src/Adapter/Product/Update/Filler/SeoFiller.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
namespace PrestaShop\PrestaShop\Adapter\Product\Update\Filler;

use PrestaShop\PrestaShop\Adapter\Category\Repository\CategoryRepository;
use PrestaShop\PrestaShop\Adapter\Domain\LocalizedObjectModelTrait;
use PrestaShop\PrestaShop\Adapter\Product\Repository\ProductRepository;
use PrestaShop\PrestaShop\Adapter\Tools;
use PrestaShop\PrestaShop\Core\Domain\Category\Exception\CategoryNotFoundException;
Expand All @@ -40,7 +41,7 @@

class SeoFiller implements ProductFillerInterface
{
use LocalizedValueFillerTrait;
use LocalizedObjectModelTrait;

/**
* @var ProductRepository
Expand Down
3 changes: 2 additions & 1 deletion src/Adapter/Product/Update/Filler/ShippingFiller.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

namespace PrestaShop\PrestaShop\Adapter\Product\Update\Filler;

use PrestaShop\PrestaShop\Adapter\Domain\LocalizedObjectModelTrait;
use PrestaShop\PrestaShop\Core\Domain\Product\Command\UpdateProductCommand;
use Product;

Expand All @@ -35,7 +36,7 @@
*/
class ShippingFiller implements ProductFillerInterface
{
use LocalizedValueFillerTrait;
use LocalizedObjectModelTrait;

/**
* {@inheritDoc}
Expand Down
3 changes: 2 additions & 1 deletion src/Adapter/Product/Update/Filler/StockInformationFiller.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

namespace PrestaShop\PrestaShop\Adapter\Product\Update\Filler;

use PrestaShop\PrestaShop\Adapter\Domain\LocalizedObjectModelTrait;
use PrestaShop\PrestaShop\Core\Domain\Product\Command\UpdateProductCommand;
use PrestaShop\PrestaShop\Core\Domain\Product\Stock\Command\UpdateProductStockAvailableCommand;
use PrestaShop\PrestaShop\Core\Util\DateTime\DateTime;
Expand All @@ -38,7 +39,7 @@
*/
class StockInformationFiller implements ProductFillerInterface
{
use LocalizedValueFillerTrait;
use LocalizedObjectModelTrait;

/**
* @param Product $product
Expand Down

0 comments on commit 630e56f

Please sign in to comment.