src/Entity/SubCategory.php line 15

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