<?php
namespace App\Entity;
use App\Repository\SupCategorieRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=SupCategorieRepository::class)
*/
class SupCategorie
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
*/
private $designation;
/**
* @ORM\OneToMany(targetEntity=Category::class, mappedBy="supCategory")
*/
private $categories;
/**
* @ORM\ManyToOne(targetEntity=Classement::class, inversedBy="supCategories")
*/
private $classement;
public function __construct()
{
$this->categories = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getDesignation(): ?string
{
return $this->designation;
}
public function setDesignation(string $designation): self
{
$this->designation = $designation;
return $this;
}
/**
* @return Collection<int, Category>
*/
public function getCategories(): Collection
{
return $this->categories;
}
public function addCategory(Category $category): self
{
if (!$this->categories->contains($category)) {
$this->categories[] = $category;
$category->setSupCategory($this);
}
return $this;
}
public function removeCategory(Category $category): self
{
if ($this->categories->removeElement($category)) {
// set the owning side to null (unless already changed)
if ($category->getSupCategory() === $this) {
$category->setSupCategory(null);
}
}
return $this;
}
public function getClassement(): ?Classement
{
return $this->classement;
}
public function setClassement(?Classement $classement): self
{
$this->classement = $classement;
return $this;
}
}