src/Entity/SubCategory.php line 14

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