<?phpnamespace App\Entity;use App\Entity\Trait\isActif;use App\Repository\WasteTypeRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;/** * @ORM\Entity(repositoryClass=WasteTypeRepository::class) */class WasteType{ use isActif; /** * @ORM\Id * @ORM\GeneratedValue * @ORM\Column(type="integer") */ private $id; /** * @ORM\Column(type="string", length=255) */ private $name; /** * @ORM\ManyToMany(targetEntity=Collect::class, mappedBy="wasteType") */ private $collects; /** * @ORM\ManyToMany(targetEntity=Equipment::class, mappedBy="waste_type") */ private $equipment; /** * @ORM\OneToMany(targetEntity=Contract::class, mappedBy="waste") */ private $contracts; public function __construct() { $this->collects = new ArrayCollection(); $this->equipment = new ArrayCollection(); $this->contracts = 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 Collection|Collect[] */ public function getCollects(): Collection { return $this->collects; } public function addCollect(Collect $collect): self { if (! $this->collects->contains($collect)) { $this->collects[] = $collect; $collect->addWasteType($this); } return $this; } public function removeCollect(Collect $collect): self { if ($this->collects->removeElement($collect)) { $collect->removeWasteType($this); } return $this; } /** * @return Collection|Equipment[] */ public function getEquipment(): Collection { return $this->equipment; } public function addEquipment(Equipment $equipment): self { if (! $this->equipment->contains($equipment)) { $this->equipment[] = $equipment; $equipment->addWasteType($this); } return $this; } public function removeEquipment(Equipment $equipment): self { if ($this->equipment->removeElement($equipment)) { $equipment->removeWasteType($this); } return $this; } public function __toString(): string { return $this->name; } /** * @return Collection|Contract[] */ public function getContracts(): Collection { return $this->contracts; } public function addContract(Contract $contract): self { if (! $this->contracts->contains($contract)) { $this->contracts[] = $contract; $contract->setWaste($this); } return $this; } public function removeContract(Contract $contract): self { if ($this->contracts->removeElement($contract)) { // set the owning side to null (unless already changed) if ($contract->getWaste() === $this) { $contract->setWaste(null); } } return $this; }}