<?phpnamespace App\Entity;use App\Entity\Trait\isActif;use App\Entity\Trait\isQuantifiable;use App\Repository\EquipmentRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;use Doctrine\ORM\Mapping\JoinTable;/** * @ORM\Entity(repositoryClass=EquipmentRepository::class) */class Equipment{ use isQuantifiable; use isActif; /** * @ORM\Id * @ORM\GeneratedValue * @ORM\Column(type="integer") */ private $id; /** * @ORM\Column(type="string", length=255) */ private $name; /** * @ORM\ManyToMany(targetEntity=WasteType::class, inversedBy="equipment") * @JoinTable(name="Equipment_Has_WasteType") */ private $waste_type; /** * @ORM\OneToMany(targetEntity=ContractHasEquipment::class, mappedBy="equipment") */ private $contractHasEquipment; public function __construct() { $this->waste_type = new ArrayCollection(); $this->contractHasEquipment = 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|WasteType[] */ public function getWasteType(): Collection { return $this->waste_type; } public function addWasteType(WasteType $wasteType): self { if (! $this->waste_type->contains($wasteType)) { $this->waste_type[] = $wasteType; } return $this; } public function removeWasteType(WasteType $wasteType): self { $this->waste_type->removeElement($wasteType); return $this; } public function __toString(): string { return $this->getName() . ' ' . $this->getQuantity() . ' ' . $this->getMetric(); } /** * @return Collection|ContractHasEquipment[] */ public function getContractHasEquipment(): Collection { return $this->contractHasEquipment; } public function addContractHasEquipment(ContractHasEquipment $contractHasEquipment): self { if (! $this->contractHasEquipment->contains($contractHasEquipment)) { $this->contractHasEquipment[] = $contractHasEquipment; $contractHasEquipment->setEquipment($this); } return $this; } public function removeContractHasEquipment(ContractHasEquipment $contractHasEquipment): self { if ($this->contractHasEquipment->removeElement($contractHasEquipment)) { // set the owning side to null (unless already changed) if ($contractHasEquipment->getEquipment() === $this) { $contractHasEquipment->setEquipment(null); } } return $this; }}