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

Commit 8db13ed

Browse files
authored
bugfix(product) audits adjustments (#1821)
1 parent 8d49fa3 commit 8db13ed

File tree

6 files changed

+37
-76
lines changed

6 files changed

+37
-76
lines changed

module/product/src/Application/Handler/AbstractAuditEventHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
use Ergonode\SharedKernel\Domain\Aggregate\UserId;
1212
use Ergonode\SharedKernel\Domain\User\UserInterface;
1313
use Doctrine\DBAL\Connection;
14-
use Ergonode\Core\Application\Security\Security;
14+
use Symfony\Component\Security\Core\Security;
1515

1616
abstract class AbstractAuditEventHandler
1717
{

module/product/src/Infrastructure/Handler/AbstractUpdateProductHandler.php

Lines changed: 0 additions & 64 deletions
This file was deleted.

module/product/src/Infrastructure/Handler/Update/UpdateGroupingProductCommandHandler.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,19 @@
99

1010
namespace Ergonode\Product\Infrastructure\Handler\Update;
1111

12+
use Ergonode\Product\Domain\Repository\ProductRepositoryInterface;
1213
use Webmozart\Assert\Assert;
1314
use Ergonode\Product\Domain\Command\Update\UpdateGroupingProductCommand;
14-
use Ergonode\Product\Infrastructure\Handler\AbstractUpdateProductHandler;
1515

16-
class UpdateGroupingProductCommandHandler extends AbstractUpdateProductHandler
16+
class UpdateGroupingProductCommandHandler
1717
{
18+
private ProductRepositoryInterface $productRepository;
19+
20+
public function __construct(ProductRepositoryInterface $productRepository)
21+
{
22+
$this->productRepository = $productRepository;
23+
}
24+
1825
/**
1926
* @throws \Exception
2027
*/
@@ -25,7 +32,6 @@ public function __invoke(UpdateGroupingProductCommand $command): void
2532

2633
$product->changeTemplate($command->getTemplateId());
2734
$product->changeCategories($command->getCategories());
28-
$product = $this->updateAudit($product);
2935

3036
$this->productRepository->save($product);
3137
}

module/product/src/Infrastructure/Handler/Update/UpdateSimpleProductCommandHandler.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,19 @@
99

1010
namespace Ergonode\Product\Infrastructure\Handler\Update;
1111

12+
use Ergonode\Product\Domain\Repository\ProductRepositoryInterface;
1213
use Webmozart\Assert\Assert;
1314
use Ergonode\Product\Domain\Command\Update\UpdateSimpleProductCommand;
14-
use Ergonode\Product\Infrastructure\Handler\AbstractUpdateProductHandler;
1515

16-
class UpdateSimpleProductCommandHandler extends AbstractUpdateProductHandler
16+
class UpdateSimpleProductCommandHandler
1717
{
18+
private ProductRepositoryInterface $productRepository;
19+
20+
public function __construct(ProductRepositoryInterface $productRepository)
21+
{
22+
$this->productRepository = $productRepository;
23+
}
24+
1825
/**
1926
* @throws \Exception
2027
*/
@@ -25,7 +32,6 @@ public function __invoke(UpdateSimpleProductCommand $command): void
2532

2633
$product->changeTemplate($command->getTemplateId());
2734
$product->changeCategories($command->getCategories());
28-
$product = $this->updateAudit($product);
2935

3036
$this->productRepository->save($product);
3137
}

module/product/src/Infrastructure/Handler/Update/UpdateVariableProductCommandHandler.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,20 @@
99

1010
namespace Ergonode\Product\Infrastructure\Handler\Update;
1111

12+
use Ergonode\Product\Domain\Repository\ProductRepositoryInterface;
1213
use Webmozart\Assert\Assert;
1314
use Ergonode\Product\Domain\Command\Update\UpdateVariableProductCommand;
14-
use Ergonode\Product\Infrastructure\Handler\AbstractUpdateProductHandler;
1515
use Ergonode\Product\Domain\Entity\VariableProduct;
1616

17-
class UpdateVariableProductCommandHandler extends AbstractUpdateProductHandler
17+
class UpdateVariableProductCommandHandler
1818
{
19+
private ProductRepositoryInterface $productRepository;
20+
21+
public function __construct(ProductRepositoryInterface $productRepository)
22+
{
23+
$this->productRepository = $productRepository;
24+
}
25+
1926
/**
2027
* @throws \Exception
2128
*/
@@ -27,7 +34,6 @@ public function __invoke(UpdateVariableProductCommand $command): void
2734

2835
$product->changeTemplate($command->getTemplateId());
2936
$product->changeCategories($command->getCategories());
30-
$product = $this->updateAudit($product);
3137

3238
$this->productRepository->save($product);
3339
}

module/product/src/Infrastructure/Handler/UpdateProductCategoriesCommandHandler.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,19 @@
99

1010
namespace Ergonode\Product\Infrastructure\Handler;
1111

12+
use Ergonode\Product\Domain\Repository\ProductRepositoryInterface;
1213
use Webmozart\Assert\Assert;
1314
use Ergonode\Product\Domain\Command\UpdateProductCategoriesCommand;
1415

15-
class UpdateProductCategoriesCommandHandler extends AbstractUpdateProductHandler
16+
class UpdateProductCategoriesCommandHandler
1617
{
18+
private ProductRepositoryInterface $productRepository;
19+
20+
public function __construct(ProductRepositoryInterface $productRepository)
21+
{
22+
$this->productRepository = $productRepository;
23+
}
24+
1725
/**
1826
* @throws \Exception
1927
*/
@@ -23,7 +31,6 @@ public function __invoke(UpdateProductCategoriesCommand $command): void
2331
Assert::notNull($product);
2432

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

2835
$this->productRepository->save($product);
2936
}

0 commit comments

Comments
 (0)