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