<?php
namespace App\Entity;
use App\Repository\CategorieAffaireRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: CategorieAffaireRepository::class)]class CategorieAffaire
{
#[ORM\Id] #[ORM\GeneratedValue] #[ORM\Column(type: 'integer')] private $id;
#[ORM\Column(type: 'string', length: 255, nullable: true)] private $libelleCourt;
#[ORM\Column(type: 'string', length: 255, nullable: true)] private $libelleLong;
#[ORM\Column(type: 'text', nullable: true)] private $remarques;
#[ORM\OneToMany(targetEntity: Affaire::class, mappedBy: 'categorie', cascade: ['persist', 'detach'])] private $affaires;
public function __construct()
{
$this->affaires = new ArrayCollection();
}
public function __toString()
{
return $this->getLibelleCourt();
}
public function getId(): ?int
{
return $this->id;
}
public function getLibelleCourt(): ?string
{
return $this->libelleCourt;
}
public function setLibelleCourt(?string $libelleCourt): self
{
$this->libelleCourt = $libelleCourt;
return $this;
}
public function getLibelleLong(): ?string
{
return $this->libelleLong;
}
public function setLibelleLong(?string $libelleLong): self
{
$this->libelleLong = $libelleLong;
return $this;
}
public function getRemarques(): ?string
{
return $this->remarques;
}
public function setRemarques(?string $remarques): self
{
$this->remarques = $remarques;
return $this;
}
/**
* @return Collection|Affaire[]
*/
public function getAffaires(): Collection
{
return $this->affaires;
}
public function addAffaire(Affaire $affaire): self
{
if (!$this->affaires->contains($affaire)) {
$this->affaires[] = $affaire;
$affaire->setCategorie($this);
}
return $this;
}
public function removeAffaire(Affaire $affaire): self
{
if ($this->affaires->removeElement($affaire)) {
// set the owning side to null (unless already changed)
if ($affaire->getCategorie() === $this) {
$affaire->setCategorie(null);
}
}
return $this;
}
}