No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

136 líneas
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. if ($this->getProductFamily()->hasProductsWithVariousWeight()) {
  57. $title .= ' - ' . $this->getQuantityLabelInherited();
  58. }
  59. return $title;
  60. }
  61. public function getProductFamily(): ?ProductFamilyInterface
  62. {
  63. return $this->productFamily;
  64. }
  65. public function setProductFamily(?ProductFamilyInterface $productFamily): self
  66. {
  67. $this->productFamily = $productFamily;
  68. return $this;
  69. }
  70. public function getTitle(): ?string
  71. {
  72. return $this->title;
  73. }
  74. public function setTitle(?string $title): self
  75. {
  76. $this->title = $title;
  77. return $this;
  78. }
  79. public function getOriginProduct(): ?bool
  80. {
  81. return $this->originProduct;
  82. }
  83. public function setOriginProduct(?bool $originProduct): self
  84. {
  85. $this->originProduct = $originProduct;
  86. return $this;
  87. }
  88. public function getExportTitle(): ?string
  89. {
  90. return $this->exportTitle;
  91. }
  92. public function setExportTitle(?string $exportTitle): self
  93. {
  94. $this->exportTitle = $exportTitle;
  95. return $this;
  96. }
  97. public function getExportNote(): ?string
  98. {
  99. return $this->exportNote;
  100. }
  101. public function setExportNote(?string $exportNote): self
  102. {
  103. $this->exportNote = $exportNote;
  104. return $this;
  105. }
  106. }