src/Entity/SubCategory.php line 16

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Entity\ReseauSociaux\Espace;
  4. use App\Entity\ReseauSociaux\Publication;
  5. use App\Repository\SubCategoryRepository;
  6. use Doctrine\Common\Collections\ArrayCollection;
  7. use Doctrine\Common\Collections\Collection;
  8. use Symfony\Component\Serializer\Annotation\Groups;
  9. use Doctrine\ORM\Mapping as ORM;
  10. /**
  11.  * @ORM\Entity(repositoryClass=SubCategoryRepository::class)
  12.  */
  13. class SubCategory
  14. {
  15.     const LOGEMENT_D_EXCEPTION 'logement-d-exception';
  16.     const HOTEL_LOCATION_SAISONNIERE 'hotel-location-saisonniere';
  17.     /**
  18.      * @ORM\Id()
  19.      * @ORM\GeneratedValue()
  20.      * @ORM\Column(type="integer")
  21.      * @Groups({"subcategory:read", "group-subcategory:read"})
  22.      */
  23.     private $id;
  24.     /**
  25.      * @ORM\Column(type="string", length=255)
  26.      * @Groups({"publication:read", "post:read", "subcategory:read", "group-subcategory:read"})
  27.      */
  28.     private $name;
  29.     /**
  30.      * @ORM\Column(type="string", length=255)
  31.      * @Groups({"publication:read","post:read","subcategory:read"})
  32.      */
  33.     private $subCategorySlug;
  34.     /**
  35.      * @ORM\ManyToMany(targetEntity=Category::class, inversedBy="subCategories")
  36.      * @Groups("publication:read","subCategory:read","post:read")
  37.      */
  38.     private $categories;
  39.     /**
  40.      * @ORM\Column(type="boolean", nullable=true)
  41.      */
  42.     private $isSuivi;
  43.     /**
  44.      * @ORM\Column(type="boolean", nullable=true)
  45.      */
  46.     private $isClothing;
  47.     /**
  48.      * @ORM\Column(type="boolean", nullable=true)
  49.      */
  50.     private $isColor;
  51.     /**
  52.      * @ORM\Column(type="boolean", nullable=true)
  53.      */
  54.     private $isNbGuest;
  55.     /**
  56.      * @ORM\Column(type="string", length=255, nullable=true)
  57.      * @Groups("publication:read","post:read")
  58.      */
  59.     private $image;
  60.     /**
  61.      * @ORM\Column(type="boolean", nullable=true)
  62.      */
  63.     private $isClothingRing;
  64.     /**
  65.      * @ORM\ManyToMany(targetEntity=Product::class, mappedBy="subCategories")
  66.      */
  67.     private $products;
  68.     /**
  69.      * @ORM\Column(type="boolean", nullable=true)
  70.      */
  71.     private $isService;
  72.     /**
  73.      * @ORM\Column(type="boolean", nullable=true)
  74.      */
  75.     private $isFairepart;
  76.     /**
  77.      * @ORM\Column(type="boolean")
  78.      */
  79.     private $isVehicle;
  80.     /**
  81.      * @ORM\OneToMany(targetEntity=Annonce::class, mappedBy="subcategory")
  82.      */
  83.     private $annonces;
  84.     /**
  85.      * @ORM\ManyToMany(targetEntity=Espace::class, mappedBy="subcategories")
  86.      */
  87.     private $espaces;
  88.     /**
  89.      * @ORM\OneToMany(targetEntity=Publication::class, mappedBy="subCategory")
  90.      */
  91.     private $publications;
  92.     public function __construct()
  93.     {
  94.         $this->companies = new ArrayCollection();
  95.         $this->isSuivi false;
  96.         $this->isClothing false;
  97.         $this->isColor false;
  98.         $this->isNbGuest false;
  99.         $this->isClothingRing false;
  100.         $this->products = new ArrayCollection();
  101.         $this->categories = new ArrayCollection();
  102.         $this->annonces = new ArrayCollection();
  103.         $this->espaces = new ArrayCollection();
  104.         $this->publications = new ArrayCollection();
  105.     }
  106.     public function getId(): ?int
  107.     {
  108.         return $this->id;
  109.     }
  110.     public function getName(): ?string
  111.     {
  112.         return $this->name;
  113.     }
  114.     public function setName(string $name): self
  115.     {
  116.         $this->name $name;
  117.         return $this;
  118.     }
  119.     /**
  120.      * @return mixed
  121.      */
  122.     public function getSubCategorySlug()
  123.     {
  124.         return $this->subCategorySlug;
  125.     }
  126.     /**
  127.      * @param mixed $subCategorySlug
  128.      */
  129.     public function setSubCategorySlug($subCategorySlug): void
  130.     {
  131.         $this->subCategorySlug $subCategorySlug;
  132.     }
  133.     public function getIsSuivi(): ?bool
  134.     {
  135.         return $this->isSuivi;
  136.     }
  137.     public function setIsSuivi(?bool $isSuivi): self
  138.     {
  139.         $this->isSuivi $isSuivi;
  140.         return $this;
  141.     }
  142.     public function getIsClothing(): ?bool
  143.     {
  144.         return $this->isClothing;
  145.     }
  146.     public function setIsClothing(?bool $isClothing): self
  147.     {
  148.         $this->isClothing $isClothing;
  149.         return $this;
  150.     }
  151.     public function getIsColor(): ?bool
  152.     {
  153.         return $this->isColor;
  154.     }
  155.     public function setIsColor(?bool $isColor): self
  156.     {
  157.         $this->isColor $isColor;
  158.         return $this;
  159.     }
  160.     public function getIsNbGuest(): ?bool
  161.     {
  162.         return $this->isNbGuest;
  163.     }
  164.     public function setIsNbGuest(?bool $isNbGuest): self
  165.     {
  166.         $this->isNbGuest $isNbGuest;
  167.         return $this;
  168.     }
  169.     public function getImage(): ?string
  170.     {
  171.         return $this->image;
  172.     }
  173.     public function setImage(?string $image): self
  174.     {
  175.         $this->image $image;
  176.         return $this;
  177.     }
  178.     public function getIsClothingRing(): ?bool
  179.     {
  180.         return $this->isClothingRing;
  181.     }
  182.     public function setIsClothingRing(?bool $isClothingRing): self
  183.     {
  184.         $this->isClothingRing $isClothingRing;
  185.         return $this;
  186.     }
  187.     /**
  188.      * @return Collection|Product[]
  189.      */
  190.     public function getProducts(): Collection
  191.     {
  192.         return $this->products;
  193.     }
  194.     public function addProduct(Product $product): self
  195.     {
  196.         if (!$this->products->contains($product)) {
  197.             $this->products[] = $product;
  198.             $product->addSubCategory($this);
  199.         }
  200.         return $this;
  201.     }
  202.     public function removeProduct(Product $product): self
  203.     {
  204.         if ($this->products->removeElement($product)) {
  205.             $product->removeSubCategory($this);
  206.         }
  207.         return $this;
  208.     }
  209.     public function getIsService(): ?bool
  210.     {
  211.         return $this->isService;
  212.     }
  213.     public function setIsService(?bool $isService): self
  214.     {
  215.         $this->isService $isService;
  216.         return $this;
  217.     }
  218.     /**
  219.      * @return Collection|Category[]
  220.      */
  221.     public function getCategories(): Collection
  222.     {
  223.         return $this->categories;
  224.     }
  225.     public function addCategory(Category $category): self
  226.     {
  227.         if (!$this->categories->contains($category)) {
  228.             $this->categories[] = $category;
  229.         }
  230.         return $this;
  231.     }
  232.     public function removeCategory(Category $category): self
  233.     {
  234.         $this->categories->removeElement($category);
  235.         return $this;
  236.     }
  237.     public function getIsFairepart(): ?bool
  238.     {
  239.         return $this->isFairepart;
  240.     }
  241.     public function setIsFairepart(?bool $isFairepart): self
  242.     {
  243.         $this->isFairepart $isFairepart;
  244.         return $this;
  245.     }
  246.     public function getIsVehicle(): ?bool
  247.     {
  248.         return $this->isVehicle;
  249.     }
  250.     public function setIsVehicle(bool $isVehicle): self
  251.     {
  252.         $this->isVehicle $isVehicle;
  253.         return $this;
  254.     }
  255.     /**
  256.      * @return Collection<int, Annonce>
  257.      */
  258.     public function getAnnonces(): Collection
  259.     {
  260.         return $this->annonces;
  261.     }
  262.     public function addAnnonce(Annonce $annonce): self
  263.     {
  264.         if (!$this->annonces->contains($annonce)) {
  265.             $this->annonces[] = $annonce;
  266.             $annonce->setSubcategory($this);
  267.         }
  268.         return $this;
  269.     }
  270.     public function removeAnnonce(Annonce $annonce): self
  271.     {
  272.         if ($this->annonces->removeElement($annonce)) {
  273.             // set the owning side to null (unless already changed)
  274.             if ($annonce->getSubcategory() === $this) {
  275.                 $annonce->setSubcategory(null);
  276.             }
  277.         }
  278.         return $this;
  279.     }
  280.     /**
  281.      * @return Collection<int, Espace>
  282.      */
  283.     public function getEspaces(): Collection
  284.     {
  285.         return $this->espaces;
  286.     }
  287.     public function addEspace(Espace $espace): self
  288.     {
  289.         if (!$this->espaces->contains($espace)) {
  290.             $this->espaces[] = $espace;
  291.             $espace->addSubcategory($this);
  292.         }
  293.         return $this;
  294.     }
  295.     public function removeEspace(Espace $espace): self
  296.     {
  297.         if ($this->espaces->removeElement($espace)) {
  298.             $espace->removeSubcategory($this);
  299.         }
  300.         return $this;
  301.     }
  302.     /**
  303.      * @return Collection<int, Publication>
  304.      */
  305.     public function getPublications(): Collection
  306.     {
  307.         return $this->publications;
  308.     }
  309.     public function addPublication(Publication $publication): self
  310.     {
  311.         if (!$this->publications->contains($publication)) {
  312.             $this->publications[] = $publication;
  313.             $publication->setSubCategory($this);
  314.         }
  315.         return $this;
  316.     }
  317.     public function removePublication(Publication $publication): self
  318.     {
  319.         if ($this->publications->removeElement($publication)) {
  320.             // set the owning side to null (unless already changed)
  321.             if ($publication->getSubCategory() === $this) {
  322.                 $publication->setSubCategory(null);
  323.             }
  324.         }
  325.         return $this;
  326.     }
  327.     
  328. }