<?php
declare(strict_types=1);
namespace App\Entity\Product;
use Brille24\SyliusTierPricePlugin\Entity\ProductVariantInterface;
use Brille24\SyliusTierPricePlugin\Traits\TierPriceableTrait;
use Doctrine\ORM\Mapping as ORM;
use Sylius\Component\Core\Model\ProductVariant as BaseProductVariant;
use Sylius\Component\Product\Model\ProductVariantTranslationInterface;
/**
* @ORM\Entity
* @ORM\Table(name="sylius_product_variant")
*/
class ProductVariant extends BaseProductVariant implements ProductVariantInterface
{
use TierPriceableTrait;
public function __construct()
{
parent::__construct();
$this->initTierPriceableTrait();
}
protected function createTranslation(): ProductVariantTranslationInterface
{
return new ProductVariantTranslation();
}
public function getDescription(): ?string
{
return $this->getTranslation()->getDescription();
}
/** @ORM\Column(type="string", length=511, nullable=true) */
protected ?string $storageArea = null;
/** @ORM\Column(type="string", length=511, nullable=true) */
protected ?string $eanCode = null;
/** @ORM\Column(name="purchase_price", type="integer", nullable=true) */
protected ?int $purchasePrice;
/**
* @var \DateTimeInterface|null
*
* @ORM\Column(name="archived_at", type="datetime", nullable=true)
*/
protected $archivedAt;
/**
* @ORM\OneToMany(
* targetEntity="Brille24\SyliusTierPricePlugin\Entity\TierPriceInterface",
* mappedBy="productVariant",
* cascade={"all"},
* orphanRemoval=true
* )
* @ORM\OrderBy({"customerGroup" = "ASC", "qty" = "ASC"})
*/
protected $tierPrices;
public function getStorageArea(): ?string
{
return $this->storageArea;
}
public function setStorageArea(?string $storageArea): void
{
$this->storageArea = $storageArea;
}
public function getEanCode(): ?string
{
return $this->eanCode;
}
public function setEanCode(?string $eanCode): void
{
$this->eanCode = $eanCode;
}
public function getPurchasePrice(): ?int
{
return $this->purchasePrice;
}
public function setPurchasePrice(?int $purchasePrice): void
{
$this->purchasePrice = $purchasePrice;
}
public function getArchivedAt(): ?\DateTimeInterface
{
return $this->archivedAt;
}
public function setArchivedAt(?\DateTimeInterface $archivedAt): void
{
$this->archivedAt = $archivedAt;
}
}