src/Entity/Product/ProductVariant.php line 17

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace App\Entity\Product;
  4. use Brille24\SyliusTierPricePlugin\Entity\ProductVariantInterface;
  5. use Brille24\SyliusTierPricePlugin\Traits\TierPriceableTrait;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Sylius\Component\Core\Model\ProductVariant as BaseProductVariant;
  8. use Sylius\Component\Product\Model\ProductVariantTranslationInterface;
  9. /**
  10.  * @ORM\Entity
  11.  * @ORM\Table(name="sylius_product_variant")
  12.  */
  13. class ProductVariant extends BaseProductVariant implements ProductVariantInterface
  14. {
  15.     use TierPriceableTrait;
  16.     public function __construct()
  17.     {
  18.         parent::__construct();
  19.         $this->initTierPriceableTrait();
  20.     }
  21.     protected function createTranslation(): ProductVariantTranslationInterface
  22.     {
  23.         return new ProductVariantTranslation();
  24.     }
  25.     public function getDescription(): ?string
  26.     {
  27.         return $this->getTranslation()->getDescription();
  28.     }
  29.     /** @ORM\Column(type="string", length=511, nullable=true) */
  30.     protected ?string $storageArea null;
  31.     /** @ORM\Column(type="string", length=511, nullable=true) */
  32.     protected ?string $eanCode null;
  33.     /** @ORM\Column(name="purchase_price", type="integer", nullable=true) */
  34.     protected ?int $purchasePrice;
  35.     /**
  36.      * @var \DateTimeInterface|null
  37.      *
  38.      * @ORM\Column(name="archived_at", type="datetime", nullable=true)
  39.      */
  40.     protected $archivedAt;
  41.     /**
  42.      * @ORM\OneToMany(
  43.      *   targetEntity="Brille24\SyliusTierPricePlugin\Entity\TierPriceInterface",
  44.      *   mappedBy="productVariant",
  45.      *   cascade={"all"},
  46.      *   orphanRemoval=true
  47.      * )
  48.      * @ORM\OrderBy({"customerGroup" = "ASC", "qty" = "ASC"})
  49.      */
  50.     protected $tierPrices;
  51.     public function getStorageArea(): ?string
  52.     {
  53.         return $this->storageArea;
  54.     }
  55.     public function setStorageArea(?string $storageArea): void
  56.     {
  57.         $this->storageArea $storageArea;
  58.     }
  59.     public function getEanCode(): ?string
  60.     {
  61.         return $this->eanCode;
  62.     }
  63.     public function setEanCode(?string $eanCode): void
  64.     {
  65.         $this->eanCode $eanCode;
  66.     }
  67.     public function getPurchasePrice(): ?int
  68.     {
  69.         return $this->purchasePrice;
  70.     }
  71.     public function setPurchasePrice(?int $purchasePrice): void
  72.     {
  73.         $this->purchasePrice $purchasePrice;
  74.     }
  75.     public function getArchivedAt(): ?\DateTimeInterface
  76.     {
  77.         return $this->archivedAt;
  78.     }
  79.     public function setArchivedAt(?\DateTimeInterface $archivedAt): void
  80.     {
  81.         $this->archivedAt $archivedAt;
  82.     }
  83. }