|
- <?php
-
- namespace Lc\CaracoleBundle\Model\Product;
-
- use Doctrine\Common\Collections\ArrayCollection;
- use Doctrine\ORM\Mapping as ORM;
- use Lc\CaracoleBundle\Doctrine\Extension\ProductPropertyTrait;
- use Lc\CaracoleBundle\Doctrine\Extension\PriceInterface;
- use Lc\CaracoleBundle\Doctrine\Extension\ProductPropertyInterface;
- use Gedmo\Mapping\Annotation as Gedmo;
- use Lc\CaracoleBundle\Model\Order\OrderShopInterface;
- use Lc\SovBundle\Doctrine\Extension\BlameableNullableTrait;
- use Lc\SovBundle\Doctrine\Extension\SortableInterface;
- use Lc\SovBundle\Doctrine\Extension\SortableTrait;
- use Lc\SovBundle\Doctrine\Extension\StatusTrait;
- use Lc\SovBundle\Doctrine\Pattern\AbstractLightEntity;
-
- /**
- * @ORM\MappedSuperclass()
- */
- abstract class ProductModel extends AbstractLightEntity implements SortableInterface, ProductPropertyInterface,
- PriceInterface, ProductInterface
- {
- use SortableTrait;
- use ProductPropertyTrait;
- use StatusTrait;
-
-
- /**
- * @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Product\ProductFamilyInterface", inversedBy="products", cascade={"persist"})
- * @ORM\JoinColumn(nullable=false)
- */
- protected $productFamily;
-
- /**
- * @ORM\Column(type="string", length=255, nullable=true)
- */
- protected $title;
-
- /**
- * @ORM\Column(type="boolean", nullable=true)
- */
- protected $originProduct;
-
- /**
- * @ORM\Column(type="string", length=255, nullable=true)
- */
- protected $exportTitle;
-
- /**
- * @ORM\Column(type="text", nullable=true)
- */
- protected $exportNote;
-
- public function __construct()
- {
- $this->orderProducts = new ArrayCollection();
- $this->status = 1;
- }
-
- public function __toString()
- {
- $title = $this->getProductFamily()->getTitle();
-
- if ($this->getTitle() && strlen($this->getTitle())) {
- $title .= ' - ' . $this->getTitle();
- }
-
- // @TODO : à remettre en place
- /*if ($this->getProductFamily()->hasProductsWithVariousWeight()) {
- $title .= ' - ' . $this->getQuantityLabelInherited();
- }*/
-
- return $title;
- }
-
- public function getProductFamily(): ?ProductFamilyInterface
- {
- return $this->productFamily;
- }
-
- public function setProductFamily(?ProductFamilyInterface $productFamily): self
- {
- $this->productFamily = $productFamily;
-
- return $this;
- }
-
- public function getTitle(): ?string
- {
- return $this->title;
- }
-
- public function setTitle(?string $title): self
- {
- $this->title = $title;
-
- return $this;
- }
-
- public function getOriginProduct(): ?bool
- {
- return $this->originProduct;
- }
-
- public function setOriginProduct(?bool $originProduct): self
- {
- $this->originProduct = $originProduct;
-
- return $this;
- }
-
- public function getExportTitle(): ?string
- {
- return $this->exportTitle;
- }
-
- public function setExportTitle(?string $exportTitle): self
- {
- $this->exportTitle = $exportTitle;
-
- return $this;
- }
-
- public function getExportNote(): ?string
- {
- return $this->exportNote;
- }
-
- public function setExportNote(?string $exportNote): self
- {
- $this->exportNote = $exportNote;
-
- return $this;
- }
- }
|