|
| 1 | +<?php |
| 2 | + |
| 3 | +declare(strict_types=1); |
| 4 | + |
| 5 | +namespace Setono\SyliusCatalogPromotionPlugin\Model; |
| 6 | + |
| 7 | +use Sylius\Component\Resource\Model\TimestampableTrait; |
| 8 | +use Symfony\Component\Uid\Uuid; |
| 9 | + |
| 10 | +class CatalogPromotionUpdate implements CatalogPromotionUpdateInterface |
| 11 | +{ |
| 12 | + use TimestampableTrait; |
| 13 | + |
| 14 | + protected ?int $id = null; |
| 15 | + |
| 16 | + protected int $version = 1; |
| 17 | + |
| 18 | + protected string $state = self::STATE_PENDING; |
| 19 | + |
| 20 | + protected string $correlationId; |
| 21 | + |
| 22 | + /** @var list<string> */ |
| 23 | + protected array $catalogPromotions = []; |
| 24 | + |
| 25 | + protected ?int $productsEligibleForUpdate = null; |
| 26 | + |
| 27 | + protected int $productsUpdated = 0; |
| 28 | + |
| 29 | + public function __construct() |
| 30 | + { |
| 31 | + $this->correlationId = (string) Uuid::v7(); |
| 32 | + } |
| 33 | + |
| 34 | + public function getId(): ?int |
| 35 | + { |
| 36 | + return $this->id; |
| 37 | + } |
| 38 | + |
| 39 | + public function getVersion(): ?int |
| 40 | + { |
| 41 | + return $this->version; |
| 42 | + } |
| 43 | + |
| 44 | + public function setVersion(?int $version): void |
| 45 | + { |
| 46 | + $this->version = (int) $version; |
| 47 | + } |
| 48 | + |
| 49 | + public function getState(): string |
| 50 | + { |
| 51 | + return $this->state; |
| 52 | + } |
| 53 | + |
| 54 | + public function setState(string $state): void |
| 55 | + { |
| 56 | + $this->state = $state; |
| 57 | + } |
| 58 | + |
| 59 | + public function getCorrelationId(): string |
| 60 | + { |
| 61 | + return $this->correlationId; |
| 62 | + } |
| 63 | + |
| 64 | + public function setCorrelationId(string $correlationId): void |
| 65 | + { |
| 66 | + $this->correlationId = $correlationId; |
| 67 | + } |
| 68 | + |
| 69 | + public function getCatalogPromotions(): array |
| 70 | + { |
| 71 | + return $this->catalogPromotions; |
| 72 | + } |
| 73 | + |
| 74 | + public function setCatalogPromotions(array $catalogPromotions): void |
| 75 | + { |
| 76 | + $this->catalogPromotions = $catalogPromotions; |
| 77 | + } |
| 78 | + |
| 79 | + public function getProductsEligibleForUpdate(): ?int |
| 80 | + { |
| 81 | + return $this->productsEligibleForUpdate; |
| 82 | + } |
| 83 | + |
| 84 | + public function setProductsEligibleForUpdate(int $productsEligibleForUpdate): void |
| 85 | + { |
| 86 | + $this->productsEligibleForUpdate = $productsEligibleForUpdate; |
| 87 | + } |
| 88 | + |
| 89 | + public function getProductsUpdated(): int |
| 90 | + { |
| 91 | + return $this->productsUpdated; |
| 92 | + } |
| 93 | + |
| 94 | + public function setProductsUpdated(int $productsUpdated): void |
| 95 | + { |
| 96 | + $this->productsUpdated = $productsUpdated; |
| 97 | + } |
| 98 | + |
| 99 | + public function incrementProductsUpdated(int $increment = 1): void |
| 100 | + { |
| 101 | + $this->productsUpdated += $increment; |
| 102 | + } |
| 103 | +} |
0 commit comments