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