src/Entity/Collect.php line 19

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Entity\Trait\isQuantifiable;
  4. use App\Entity\Trait\isSlugger;
  5. use App\Entity\Trait\isTimestamstable;
  6. use App\Repository\CollectRepository;
  7. use Doctrine\Common\Collections\ArrayCollection;
  8. use Doctrine\Common\Collections\Collection;
  9. use Doctrine\ORM\Mapping as ORM;
  10. use Doctrine\ORM\Mapping\JoinTable;
  11. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  12. /**
  13.  * @ORM\Entity(repositoryClass=CollectRepository::class)
  14.  * @UniqueEntity("slug")
  15.  */
  16. class Collect
  17. {
  18.     use isTimestamstable;
  19.     use isQuantifiable;
  20.     use isSlugger;
  21.     /**
  22.      * @ORM\Id
  23.      * @ORM\GeneratedValue
  24.      * @ORM\Column(type="integer")
  25.      */
  26.     private $id;
  27.     /**
  28.      * @ORM\ManyToOne(targetEntity=Provider::class, inversedBy="collects")
  29.      * @ORM\JoinColumn(nullable=false)
  30.      */
  31.     private $provider;
  32.     /**
  33.      * @ORM\ManyToMany(targetEntity=WasteType::class, inversedBy="collects")
  34.      * @JoinTable(name="Collect_Has_WasteType")
  35.      */
  36.     private $wasteType;
  37.     /**
  38.      * @ORM\ManyToOne(targetEntity=Contract::class, inversedBy="collects")
  39.      * @ORM\JoinColumn(nullable=false)
  40.      */
  41.     private $contract;
  42.     /**
  43.      * @ORM\Column(type="float", nullable=true)
  44.      */
  45.     private $total;
  46.     /**
  47.      * @ORM\Column(type="text", nullable=true)
  48.      */
  49.     private $message;
  50.     /**
  51.      * @ORM\Column(type="boolean")
  52.      */
  53.     private $paid false;
  54.     /**
  55.      * @ORM\OneToOne(targetEntity=Facture::class, mappedBy="collect", cascade={"persist"})
  56.      */
  57.     private $invoice;
  58.     public function __construct()
  59.     {
  60.         $this->wasteType = new ArrayCollection();
  61.     }
  62.     public function getId(): ?int
  63.     {
  64.         return $this->id;
  65.     }
  66.     public function getProvider(): ?Provider
  67.     {
  68.         return $this->provider;
  69.     }
  70.     public function setProvider(?Provider $provider): self
  71.     {
  72.         $this->provider $provider;
  73.         return $this;
  74.     }
  75.     /**
  76.      * @return Collection|WasteType[]
  77.      */
  78.     public function getWasteType(): Collection
  79.     {
  80.         return $this->wasteType;
  81.     }
  82.     public function addWasteType(WasteType $wasteType): self
  83.     {
  84.         if (! $this->wasteType->contains($wasteType)) {
  85.             $this->wasteType[] = $wasteType;
  86.         }
  87.         return $this;
  88.     }
  89.     public function removeWasteType(WasteType $wasteType): self
  90.     {
  91.         $this->wasteType->removeElement($wasteType);
  92.         return $this;
  93.     }
  94.     public function getContract(): ?Contract
  95.     {
  96.         return $this->contract;
  97.     }
  98.     public function setContract(?Contract $contract): self
  99.     {
  100.         $this->contract $contract;
  101.         return $this;
  102.     }
  103.     public function getTotal(): ?float
  104.     {
  105.         return $this->total;
  106.     }
  107.     public function setTotal(float $total): self
  108.     {
  109.         $this->total $total;
  110.         return $this;
  111.     }
  112.     public function getMessage(): ?string
  113.     {
  114.         return $this->message;
  115.     }
  116.     public function setMessage(?string $message): self
  117.     {
  118.         $this->message $message;
  119.         return $this;
  120.     }
  121.     public function getPaid(): ?bool
  122.     {
  123.         return $this->paid;
  124.     }
  125.     public function setPaid(bool $paid): self
  126.     {
  127.         $this->paid $paid;
  128.         return $this;
  129.     }
  130.     public function getInvoice(): ?Facture
  131.     {
  132.         return $this->invoice;
  133.     }
  134.     public function addInvoice(Facture $invoice): void
  135.     {
  136.         $invoice->setCollect($this);
  137.         $this->invoice $invoice;
  138.     }
  139. }