src/Entity/System/Taxonomy.php line 16

Open in your IDE?
  1. <?php
  2. namespace App\Entity\System;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\ORM\Mapping as ORM;
  6. /**
  7. * Taxonomy
  8. *
  9. * @ORM\Table(name="taxonomy")
  10. *
  11. * @ORM\Entity(repositoryClass="App\Repository\System\TaxonomyRepository")
  12. */
  13. class Taxonomy extends AbstractCategory
  14. {
  15. public const MAX_DEPTH_LEVEL = 2;
  16. public const ECOMMERCE_TAXONOMY_ID = 31557;
  17. public const MARKETPLACES_TAXONOMY_ID = 31558;
  18. public const SUPPORT_TAXONOMY_ID = 31548;
  19. public const EXCLUDED_IDS_FROM_MENU = [self::SUPPORT_TAXONOMY_ID];
  20. public const ACADEMY_TAXONOMY_ID = 31559;
  21. public const PACKS_TAXONOMY_ID = 31549;
  22. public const SHOPS_PARENT_ID = 31553;
  23. public const SHOPIFY_SHOPS_TAXONOMY_ID = 31554;
  24. public const PRESTASHOP_SHOPS_TAXONOMY_ID = 31555;
  25. public const NOT_INDEXABLE_TAXONOMY_IDS = [
  26. self::ECOMMERCE_TAXONOMY_ID,
  27. self::MARKETPLACES_TAXONOMY_ID,
  28. self::SUPPORT_TAXONOMY_ID,
  29. self::ACADEMY_TAXONOMY_ID,
  30. self::PACKS_TAXONOMY_ID,
  31. self::PRESTASHOP_SHOPS_TAXONOMY_ID,
  32. self::SHOPIFY_SHOPS_TAXONOMY_ID,
  33. ];
  34. public const TAXONOMIES_SERVICES = [
  35. self::PRESTASHOP_SHOPS_TAXONOMY_ID,
  36. self::ECOMMERCE_TAXONOMY_ID,
  37. self::MARKETPLACES_TAXONOMY_ID,
  38. self::SHOPIFY_SHOPS_TAXONOMY_ID,
  39. self::ACADEMY_TAXONOMY_ID,
  40. ];
  41. /**
  42. * @var int
  43. *
  44. * @ORM\Column(type="integer")
  45. *
  46. * @ORM\Id
  47. */
  48. protected $id;
  49. /**
  50. * @var Taxonomy
  51. *
  52. * @ORM\ManyToOne(targetEntity="App\Entity\System\Taxonomy", inversedBy="children")
  53. *
  54. * @ORM\JoinColumn(referencedColumnName="id", name="id_parent")
  55. */
  56. protected $parent;
  57. /**
  58. * @var ArrayCollection|TaxonomyLanguage[]
  59. *
  60. * @ORM\OneToMany(targetEntity="TaxonomyLanguage", mappedBy="taxonomy", cascade={"persist"}, indexBy="id_lang")
  61. *
  62. * @ORM\JoinColumn(referencedColumnName="id_taxonomy", name="id")
  63. */
  64. protected $langs;
  65. /**
  66. * @var ArrayCollection|Taxonomy[]
  67. *
  68. * @ORM\OneToMany (targetEntity="App\Entity\System\Taxonomy", mappedBy="parent")
  69. */
  70. private $children;
  71. /**
  72. * @var Product[]|Collection
  73. *
  74. * @ORM\ManyToMany(targetEntity="App\Entity\System\Product", mappedBy="taxonomies")
  75. */
  76. private $products;
  77. /**
  78. * @var ProductImage
  79. *
  80. * @ORM\ManyToOne(targetEntity="ProductImage", inversedBy="taxonomies", cascade={"persist"})
  81. *
  82. * @ORM\JoinColumn(name="id_image", referencedColumnName="id_image")
  83. */
  84. private $image;
  85. public function __construct()
  86. {
  87. parent::__construct();
  88. $this->products = new ArrayCollection();
  89. }
  90. /**
  91. * @return int
  92. */
  93. public function getId(): int
  94. {
  95. return $this->id;
  96. }
  97. /**
  98. * @param int $id
  99. */
  100. public function setId(int $id): void
  101. {
  102. $this->id = $id;
  103. }
  104. /**
  105. * @return Taxonomy|null
  106. */
  107. public function getParent(): ?Taxonomy
  108. {
  109. return $this->parent;
  110. }
  111. /**
  112. * @param Taxonomy $parent
  113. */
  114. public function setParent(Taxonomy $parent): void
  115. {
  116. $this->parent = $parent;
  117. }
  118. /**
  119. * @return TaxonomyLanguage[]|ArrayCollection
  120. */
  121. public function getLangs()
  122. {
  123. return $this->langs;
  124. }
  125. /**
  126. * @param TaxonomyLanguage[]|ArrayCollection $langs
  127. */
  128. public function setLangs($langs): void
  129. {
  130. $this->langs = $langs;
  131. }
  132. /**
  133. * @return Taxonomy[]|ArrayCollection
  134. */
  135. public function getChildren()
  136. {
  137. return $this->children;
  138. }
  139. /**
  140. * @param Taxonomy[]|ArrayCollection $children
  141. */
  142. public function setChildren($children): void
  143. {
  144. $this->children = $children;
  145. }
  146. /**
  147. * @return Product[]|Collection
  148. */
  149. public function getProducts()
  150. {
  151. return $this->products;
  152. }
  153. /**
  154. * @param Product[]|Collection $products
  155. */
  156. public function setProducts($products): void
  157. {
  158. $this->products = $products;
  159. }
  160. public function getImage(): ?ProductImage
  161. {
  162. return $this->image;
  163. }
  164. public function setImage(ProductImage $image): Taxonomy
  165. {
  166. $this->image = $image;
  167. return $this;
  168. }
  169. }