選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

137 行
3.3KB

  1. <?php
  2. namespace Lc\CaracoleBundle\Model\Product;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use Lc\CaracoleBundle\Doctrine\Extension\ProductPropertyTrait;
  6. use Lc\CaracoleBundle\Doctrine\Extension\PriceInterface;
  7. use Lc\CaracoleBundle\Doctrine\Extension\ProductPropertyInterface;
  8. use Gedmo\Mapping\Annotation as Gedmo;
  9. use Lc\CaracoleBundle\Model\Order\OrderShopInterface;
  10. use Lc\SovBundle\Doctrine\Extension\BlameableNullableTrait;
  11. use Lc\SovBundle\Doctrine\Extension\SortableInterface;
  12. use Lc\SovBundle\Doctrine\Extension\SortableTrait;
  13. use Lc\SovBundle\Doctrine\Extension\StatusTrait;
  14. use Lc\SovBundle\Doctrine\Pattern\AbstractLightEntity;
  15. /**
  16. * @ORM\MappedSuperclass()
  17. */
  18. abstract class ProductModel extends AbstractLightEntity implements SortableInterface, ProductPropertyInterface,
  19. PriceInterface, ProductInterface
  20. {
  21. use SortableTrait;
  22. use ProductPropertyTrait;
  23. use StatusTrait;
  24. /**
  25. * @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Product\ProductFamilyInterface", inversedBy="products", cascade={"persist"})
  26. * @ORM\JoinColumn(nullable=false)
  27. */
  28. protected $productFamily;
  29. /**
  30. * @ORM\Column(type="string", length=255, nullable=true)
  31. */
  32. protected $title;
  33. /**
  34. * @ORM\Column(type="boolean", nullable=true)
  35. */
  36. protected $originProduct;
  37. /**
  38. * @ORM\Column(type="string", length=255, nullable=true)
  39. */
  40. protected $exportTitle;
  41. /**
  42. * @ORM\Column(type="text", nullable=true)
  43. */
  44. protected $exportNote;
  45. public function __construct()
  46. {
  47. $this->orderProducts = new ArrayCollection();
  48. $this->status = 1;
  49. }
  50. public function __toString()
  51. {
  52. $title = $this->getProductFamily()->getTitle();
  53. if ($this->getTitle() && strlen($this->getTitle())) {
  54. $title .= ' - ' . $this->getTitle();
  55. }
  56. // @TODO : à remettre en place
  57. /*if ($this->getProductFamily()->hasProductsWithVariousWeight()) {
  58. $title .= ' - ' . $this->getQuantityLabelInherited();
  59. }*/
  60. return $title;
  61. }
  62. public function getProductFamily(): ?ProductFamilyInterface
  63. {
  64. return $this->productFamily;
  65. }
  66. public function setProductFamily(?ProductFamilyInterface $productFamily): self
  67. {
  68. $this->productFamily = $productFamily;
  69. return $this;
  70. }
  71. public function getTitle(): ?string
  72. {
  73. return $this->title;
  74. }
  75. public function setTitle(?string $title): self
  76. {
  77. $this->title = $title;
  78. return $this;
  79. }
  80. public function getOriginProduct(): ?bool
  81. {
  82. return $this->originProduct;
  83. }
  84. public function setOriginProduct(?bool $originProduct): self
  85. {
  86. $this->originProduct = $originProduct;
  87. return $this;
  88. }
  89. public function getExportTitle(): ?string
  90. {
  91. return $this->exportTitle;
  92. }
  93. public function setExportTitle(?string $exportTitle): self
  94. {
  95. $this->exportTitle = $exportTitle;
  96. return $this;
  97. }
  98. public function getExportNote(): ?string
  99. {
  100. return $this->exportNote;
  101. }
  102. public function setExportNote(?string $exportNote): self
  103. {
  104. $this->exportNote = $exportNote;
  105. return $this;
  106. }
  107. }