src/Entity/ECommerce/ProductManufacturer.php line 21

Open in your IDE?
  1. <?php
  2. namespace App\Entity\ECommerce;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use JMS\Serializer\Annotation as JMS;
  7. use App\Entity\ECommerce\Traits\DatesInterface;
  8. use App\Entity\ECommerce\Traits\DatesTrait;
  9. use App\Entity\ECommerce\Traits\RemoteInterface;
  10. use App\Entity\ECommerce\Traits\RemoteTrait;
  11. /**
  12. * ProductManufacturer
  13. *
  14. * @ORM\Table(name="product_manufacturer")
  15. * @ORM\Entity(repositoryClass="App\Repository\ECommerce\ProductManufacturerRepository")
  16. * @ORM\Cache(usage="READ_ONLY", region="public")
  17. */
  18. class ProductManufacturer implements DatesInterface, RemoteInterface, \Stringable
  19. {
  20. /**
  21. * @var int
  22. *
  23. * @ORM\Column(name="id", type="integer")
  24. * @ORM\Id
  25. * @ORM\GeneratedValue(strategy="AUTO")
  26. */
  27. private $id;
  28. /**
  29. * @var string
  30. *
  31. * @ORM\Column(name="name", type="string", length=40, unique=true)
  32. *
  33. * @JMS\Groups({"depot_products", "depot_product_private", "cart_private", "view_product"})
  34. */
  35. private $name;
  36. /**
  37. * @var int
  38. *
  39. * @ORM\Column(name="sorting_priority", type="integer", length=2, options={"default"=0})
  40. */
  41. private $sortingPriority=0;
  42. /**
  43. * @var Collection
  44. *
  45. * @ORM\ManyToMany(targetEntity="App\Entity\ECommerce\ProductInfo", mappedBy="manufacturers")
  46. */
  47. private $codes;
  48. /**
  49. * @ORM\OneToMany(targetEntity="App\Entity\ECommerce\Product", mappedBy="manufacturer")
  50. */
  51. private \Doctrine\Common\Collections\Collection $products;
  52. use DatesTrait {
  53. DatesTrait::__construct as __D_construct;
  54. }
  55. use RemoteTrait;
  56. /**
  57. * Constructor
  58. */
  59. public function __construct()
  60. {
  61. $this->codes = new ArrayCollection();
  62. $this->__D_construct();
  63. }
  64. function __toString(): string
  65. {
  66. return $this->name;
  67. }
  68. /**
  69. * Get id
  70. *
  71. * @return int
  72. */
  73. public function getId()
  74. {
  75. return $this->id;
  76. }
  77. /**
  78. * Set name
  79. *
  80. * @param string $name
  81. */
  82. public function setName($name): static
  83. {
  84. $this->name = $name;
  85. return $this;
  86. }
  87. /**
  88. * Get name
  89. *
  90. * @return string
  91. */
  92. public function getName()
  93. {
  94. return $this->name;
  95. }
  96. /**
  97. * Set sortingPriority
  98. *
  99. * @param integer $sortingPriority
  100. */
  101. public function setSortingPriority($sortingPriority): static
  102. {
  103. $this->sortingPriority = $sortingPriority;
  104. return $this;
  105. }
  106. /**
  107. * Get sortingPriority
  108. *
  109. * @return integer
  110. */
  111. public function getSortingPriority()
  112. {
  113. return $this->sortingPriority;
  114. }
  115. /**
  116. * Add code
  117. *
  118. *
  119. */
  120. public function addCode(ProductInfo $code): static
  121. {
  122. $this->codes[] = $code;
  123. return $this;
  124. }
  125. /**
  126. * Remove code
  127. */
  128. public function removeCode(ProductInfo $code): void
  129. {
  130. $this->codes->removeElement($code);
  131. }
  132. /**
  133. * Get codes
  134. *
  135. * @return \Doctrine\Common\Collections\Collection
  136. */
  137. public function getCodes()
  138. {
  139. return $this->codes;
  140. }
  141. public function getProducts(): Collection
  142. {
  143. return $this->products;
  144. }
  145. public function setProducts(Collection $products): void
  146. {
  147. $this->products = $products;
  148. }
  149. }