Skip to content
This repository has been archived by the owner on Feb 13, 2023. It is now read-only.

Commit

Permalink
bugfix(product) audits adjustments (#1821)
Browse files Browse the repository at this point in the history
  • Loading branch information
piotrkreft authored Dec 28, 2021
1 parent 8d49fa3 commit 8db13ed
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 76 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
use Ergonode\SharedKernel\Domain\Aggregate\UserId;
use Ergonode\SharedKernel\Domain\User\UserInterface;
use Doctrine\DBAL\Connection;
use Ergonode\Core\Application\Security\Security;
use Symfony\Component\Security\Core\Security;

abstract class AbstractAuditEventHandler
{
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,19 @@

namespace Ergonode\Product\Infrastructure\Handler\Update;

use Ergonode\Product\Domain\Repository\ProductRepositoryInterface;
use Webmozart\Assert\Assert;
use Ergonode\Product\Domain\Command\Update\UpdateGroupingProductCommand;
use Ergonode\Product\Infrastructure\Handler\AbstractUpdateProductHandler;

class UpdateGroupingProductCommandHandler extends AbstractUpdateProductHandler
class UpdateGroupingProductCommandHandler
{
private ProductRepositoryInterface $productRepository;

public function __construct(ProductRepositoryInterface $productRepository)
{
$this->productRepository = $productRepository;
}

/**
* @throws \Exception
*/
Expand All @@ -25,7 +32,6 @@ public function __invoke(UpdateGroupingProductCommand $command): void

$product->changeTemplate($command->getTemplateId());
$product->changeCategories($command->getCategories());
$product = $this->updateAudit($product);

$this->productRepository->save($product);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,19 @@

namespace Ergonode\Product\Infrastructure\Handler\Update;

use Ergonode\Product\Domain\Repository\ProductRepositoryInterface;
use Webmozart\Assert\Assert;
use Ergonode\Product\Domain\Command\Update\UpdateSimpleProductCommand;
use Ergonode\Product\Infrastructure\Handler\AbstractUpdateProductHandler;

class UpdateSimpleProductCommandHandler extends AbstractUpdateProductHandler
class UpdateSimpleProductCommandHandler
{
private ProductRepositoryInterface $productRepository;

public function __construct(ProductRepositoryInterface $productRepository)
{
$this->productRepository = $productRepository;
}

/**
* @throws \Exception
*/
Expand All @@ -25,7 +32,6 @@ public function __invoke(UpdateSimpleProductCommand $command): void

$product->changeTemplate($command->getTemplateId());
$product->changeCategories($command->getCategories());
$product = $this->updateAudit($product);

$this->productRepository->save($product);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,20 @@

namespace Ergonode\Product\Infrastructure\Handler\Update;

use Ergonode\Product\Domain\Repository\ProductRepositoryInterface;
use Webmozart\Assert\Assert;
use Ergonode\Product\Domain\Command\Update\UpdateVariableProductCommand;
use Ergonode\Product\Infrastructure\Handler\AbstractUpdateProductHandler;
use Ergonode\Product\Domain\Entity\VariableProduct;

class UpdateVariableProductCommandHandler extends AbstractUpdateProductHandler
class UpdateVariableProductCommandHandler
{
private ProductRepositoryInterface $productRepository;

public function __construct(ProductRepositoryInterface $productRepository)
{
$this->productRepository = $productRepository;
}

/**
* @throws \Exception
*/
Expand All @@ -27,7 +34,6 @@ public function __invoke(UpdateVariableProductCommand $command): void

$product->changeTemplate($command->getTemplateId());
$product->changeCategories($command->getCategories());
$product = $this->updateAudit($product);

$this->productRepository->save($product);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,19 @@

namespace Ergonode\Product\Infrastructure\Handler;

use Ergonode\Product\Domain\Repository\ProductRepositoryInterface;
use Webmozart\Assert\Assert;
use Ergonode\Product\Domain\Command\UpdateProductCategoriesCommand;

class UpdateProductCategoriesCommandHandler extends AbstractUpdateProductHandler
class UpdateProductCategoriesCommandHandler
{
private ProductRepositoryInterface $productRepository;

public function __construct(ProductRepositoryInterface $productRepository)
{
$this->productRepository = $productRepository;
}

/**
* @throws \Exception
*/
Expand All @@ -23,7 +31,6 @@ public function __invoke(UpdateProductCategoriesCommand $command): void
Assert::notNull($product);

$product->changeCategories($command->getCategories());
$product = $this->updateAudit($product);

$this->productRepository->save($product);
}
Expand Down

0 comments on commit 8db13ed

Please sign in to comment.