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