<?php
namespace App\Entity;
use App\Repository\SubCategoryRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Symfony\Component\Serializer\Annotation\Groups;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=SubCategoryRepository::class)
*/
class SubCategory
{
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
* @Groups("subcategory:read")
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
* @Groups("publication:read","post:read")
*/
private $name;
/**
* @ORM\Column(type="string", length=255)
* @Groups("publication:read","post:read")
*/
private $subCategorySlug;
/**
* @ORM\ManyToMany(targetEntity=Category::class, inversedBy="subCategories")
* @Groups("publication:read","subCategory:read","post:read")
*/
private $categories;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $isSuivi;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $isClothing;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $isColor;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $isNbGuest;
/**
* @ORM\Column(type="string", length=255, nullable=true)
* @Groups("publication:read","post:read")
*/
private $image;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $isClothingRing;
/**
* @ORM\ManyToMany(targetEntity=Product::class, mappedBy="subCategories")
*/
private $products;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $isService;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $isFairepart;
/**
* @ORM\Column(type="boolean")
*/
private $isVehicle;
/**
* @ORM\OneToMany(targetEntity=Annonce::class, mappedBy="subcategory")
*/
private $annonces;
public function __construct()
{
$this->companies = new ArrayCollection();
$this->isSuivi = false;
$this->isClothing = false;
$this->isColor = false;
$this->isNbGuest = false;
$this->isClothingRing = false;
$this->products = new ArrayCollection();
$this->categories = new ArrayCollection();
$this->annonces = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
/**
* @return mixed
*/
public function getSubCategorySlug()
{
return $this->subCategorySlug;
}
/**
* @param mixed $subCategorySlug
*/
public function setSubCategorySlug($subCategorySlug): void
{
$this->subCategorySlug = $subCategorySlug;
}
public function getIsSuivi(): ?bool
{
return $this->isSuivi;
}
public function setIsSuivi(?bool $isSuivi): self
{
$this->isSuivi = $isSuivi;
return $this;
}
public function getIsClothing(): ?bool
{
return $this->isClothing;
}
public function setIsClothing(?bool $isClothing): self
{
$this->isClothing = $isClothing;
return $this;
}
public function getIsColor(): ?bool
{
return $this->isColor;
}
public function setIsColor(?bool $isColor): self
{
$this->isColor = $isColor;
return $this;
}
public function getIsNbGuest(): ?bool
{
return $this->isNbGuest;
}
public function setIsNbGuest(?bool $isNbGuest): self
{
$this->isNbGuest = $isNbGuest;
return $this;
}
public function getImage(): ?string
{
return $this->image;
}
public function setImage(?string $image): self
{
$this->image = $image;
return $this;
}
public function getIsClothingRing(): ?bool
{
return $this->isClothingRing;
}
public function setIsClothingRing(?bool $isClothingRing): self
{
$this->isClothingRing = $isClothingRing;
return $this;
}
/**
* @return Collection|Product[]
*/
public function getProducts(): Collection
{
return $this->products;
}
public function addProduct(Product $product): self
{
if (!$this->products->contains($product)) {
$this->products[] = $product;
$product->addSubCategory($this);
}
return $this;
}
public function removeProduct(Product $product): self
{
if ($this->products->removeElement($product)) {
$product->removeSubCategory($this);
}
return $this;
}
public function getIsService(): ?bool
{
return $this->isService;
}
public function setIsService(?bool $isService): self
{
$this->isService = $isService;
return $this;
}
/**
* @return Collection|Category[]
*/
public function getCategories(): Collection
{
return $this->categories;
}
public function addCategory(Category $category): self
{
if (!$this->categories->contains($category)) {
$this->categories[] = $category;
}
return $this;
}
public function removeCategory(Category $category): self
{
$this->categories->removeElement($category);
return $this;
}
public function getIsFairepart(): ?bool
{
return $this->isFairepart;
}
public function setIsFairepart(?bool $isFairepart): self
{
$this->isFairepart = $isFairepart;
return $this;
}
public function getIsVehicle(): ?bool
{
return $this->isVehicle;
}
public function setIsVehicle(bool $isVehicle): self
{
$this->isVehicle = $isVehicle;
return $this;
}
/**
* @return Collection<int, Annonce>
*/
public function getAnnonces(): Collection
{
return $this->annonces;
}
public function addAnnonce(Annonce $annonce): self
{
if (!$this->annonces->contains($annonce)) {
$this->annonces[] = $annonce;
$annonce->setSubcategory($this);
}
return $this;
}
public function removeAnnonce(Annonce $annonce): self
{
if ($this->annonces->removeElement($annonce)) {
// set the owning side to null (unless already changed)
if ($annonce->getSubcategory() === $this) {
$annonce->setSubcategory(null);
}
}
return $this;
}
}