<?php
namespace App\Entity;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\HttpFoundation\File\File;
use Symfony\Component\HttpFoundation\File\UploadedFile;
use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
use Doctrine\Common\Collections\ArrayCollection;
use Gedmo\Mapping\Annotation as Gedmo;
/**
* @ORM\Entity(repositoryClass="App\Repository\CategoryRepository")
*
*/
class Category
{
/**
* @Gedmo\Slug(fields={"nom"})
* @ORM\Column(length=128, unique=true)
*/
private $slug;
/**
* @ORM\OneToMany(targetEntity="App\Entity\SubCategory", mappedBy="category", cascade={"persist", "remove"})
*/
private $subCategories;
/**
* @var int
*
* @ORM\Column(name="id", type="integer", nullable=false)
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
private $id;
/**
* @var string|null
*
* @ORM\Column(name="name", type="string", length=255, nullable=true)
*/
private $nom;
/**
* @var string|null
*
* @ORM\Column(name="icon", type="string", length=50, nullable=true)
*/
private $icon;
/**
* @var string|null
*
* @ORM\Column(name="image_illustration", type="string", length=255, nullable=true)
*/
private $imageIllustration;
public function __construct()
{
$this->subCategories = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getNom(): ?string
{
return $this->nom;
}
public function setNom(?string $nom): self
{
$this->nom = $nom;
return $this;
}
public function getSlug(): ?string
{
return $this->slug;
}
public function setSlug(?string $slug): self
{
$this->slug = $slug;
return $this;
}
public function getIcon(): ?string
{
return $this->icon;
}
public function setIcon(?string $icon): self
{
$this->icon = $icon;
return $this;
}
public function getImageIllustration(): ?string
{
return $this->imageIllustration;
}
public function setImageIllustration(?string $imageIllustration): self
{
$this->imageIllustration = $imageIllustration;
return $this;
}
/**
* Add subCategories
*
* @param \App\Entity\SubCategory $subCategories
* @return Article
*/
public function addSubCategory(\App\Entity\SubCategory $subCategory)
{
$subCategory->setCategory($this);
$this->subCategories[] = $subCategory;
return $this;
}
/**
* Remove subCategories
*
* @param \App\Entity\SubCategory $subCategories
*/
public function removeSubCategory(\App\Entity\SubCategory $subCategory)
{
$this->subCategories->removeElement($subCategory);
}
/**
* Get subCategories
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getSubCategories()
{
return $this->subCategories;
}
}