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