<?phpnamespace App\Entity;use App\Entity\Trait\isQuantifiable;use App\Entity\Trait\isSlugger;use App\Entity\Trait\isTimestamstable;use App\Repository\CollectRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;use Doctrine\ORM\Mapping\JoinTable;use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;/** * @ORM\Entity(repositoryClass=CollectRepository::class) * @UniqueEntity("slug") */class Collect{ use isTimestamstable; use isQuantifiable; use isSlugger; /** * @ORM\Id * @ORM\GeneratedValue * @ORM\Column(type="integer") */ private $id; /** * @ORM\ManyToOne(targetEntity=Provider::class, inversedBy="collects") * @ORM\JoinColumn(nullable=false) */ private $provider; /** * @ORM\ManyToMany(targetEntity=WasteType::class, inversedBy="collects") * @JoinTable(name="Collect_Has_WasteType") */ private $wasteType; /** * @ORM\ManyToOne(targetEntity=Contract::class, inversedBy="collects") * @ORM\JoinColumn(nullable=false) */ private $contract; /** * @ORM\Column(type="float", nullable=true) */ private $total; /** * @ORM\Column(type="text", nullable=true) */ private $message; /** * @ORM\Column(type="boolean") */ private $paid = false; /** * @ORM\OneToOne(targetEntity=Facture::class, mappedBy="collect", cascade={"persist"}) */ private $invoice; public function __construct() { $this->wasteType = new ArrayCollection(); } public function getId(): ?int { return $this->id; } public function getProvider(): ?Provider { return $this->provider; } public function setProvider(?Provider $provider): self { $this->provider = $provider; return $this; } /** * @return Collection|WasteType[] */ public function getWasteType(): Collection { return $this->wasteType; } public function addWasteType(WasteType $wasteType): self { if (! $this->wasteType->contains($wasteType)) { $this->wasteType[] = $wasteType; } return $this; } public function removeWasteType(WasteType $wasteType): self { $this->wasteType->removeElement($wasteType); return $this; } public function getContract(): ?Contract { return $this->contract; } public function setContract(?Contract $contract): self { $this->contract = $contract; return $this; } public function getTotal(): ?float { return $this->total; } public function setTotal(float $total): self { $this->total = $total; return $this; } public function getMessage(): ?string { return $this->message; } public function setMessage(?string $message): self { $this->message = $message; return $this; } public function getPaid(): ?bool { return $this->paid; } public function setPaid(bool $paid): self { $this->paid = $paid; return $this; } public function getInvoice(): ?Facture { return $this->invoice; } public function addInvoice(Facture $invoice): void { $invoice->setCollect($this); $this->invoice = $invoice; }}