src/Entity/Dotation.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\DotationRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. #[ORM\Entity(repositoryClassDotationRepository::class)]
  8. class Dotation
  9. {
  10.     use IdentifiableTrait;
  11.     #[ORM\ManyToOne(inversedBy'dotations')]
  12.     #[ORM\JoinColumn(nullablefalse)]
  13.     private ?Product $product null;
  14.     #[ORM\Column]
  15.     private ?int $quantity null;
  16.     #[ORM\ManyToMany(targetEntityVisitReport::class, mappedBy'productShipmentRequests')]
  17.     private Collection $visitReportsProductShipmentRequests;
  18.     #[ORM\ManyToMany(targetEntityVisitReport::class, mappedBy'awardedDotations')]
  19.     private Collection $visitReportsAwardedDotations;
  20.     public function __construct()
  21.     {
  22.         $this->visitReportsProductShipmentRequests = new ArrayCollection();
  23.         $this->visitReportsAwardedDotations = new ArrayCollection();
  24.     }
  25.     public function getId(): ?int
  26.     {
  27.         return $this->id;
  28.     }
  29.     public function getProduct(): ?Product
  30.     {
  31.         return $this->product;
  32.     }
  33.     public function setProduct(?Product $product): static
  34.     {
  35.         $this->product $product;
  36.         return $this;
  37.     }
  38.     public function getQuantity(): ?int
  39.     {
  40.         return $this->quantity;
  41.     }
  42.     public function setQuantity(int $quantity): static
  43.     {
  44.         $this->quantity $quantity;
  45.         return $this;
  46.     }
  47.     /**
  48.      * @return Collection<int, VisitReport>
  49.      */
  50.     public function getVisitReportsProductShipmentRequests(): Collection
  51.     {
  52.         return $this->visitReportsProductShipmentRequests;
  53.     }
  54.     public function addVisitReportsProductShipmentRequest(VisitReport $visitReportsProductShipmentRequest): static
  55.     {
  56.         if (!$this->visitReportsProductShipmentRequests->contains($visitReportsProductShipmentRequest)) {
  57.             $this->visitReportsProductShipmentRequests->add($visitReportsProductShipmentRequest);
  58.             $visitReportsProductShipmentRequest->addProductShipmentRequest($this);
  59.         }
  60.         return $this;
  61.     }
  62.     public function removeVisitReportsProductShipmentRequest(VisitReport $visitReportsProductShipmentRequest): static
  63.     {
  64.         if ($this->visitReportsProductShipmentRequests->removeElement($visitReportsProductShipmentRequest)) {
  65.             $visitReportsProductShipmentRequest->removeProductShipmentRequest($this);
  66.         }
  67.         return $this;
  68.     }
  69.     /**
  70.      * @return Collection<int, VisitReport>
  71.      */
  72.     public function getVisitReportsAwardedDotations(): Collection
  73.     {
  74.         return $this->visitReportsAwardedDotations;
  75.     }
  76.     public function addVisitReportsAwardedDotation(VisitReport $visitReportsAwardedDotation): static
  77.     {
  78.         if (!$this->visitReportsAwardedDotations->contains($visitReportsAwardedDotation)) {
  79.             $this->visitReportsAwardedDotations->add($visitReportsAwardedDotation);
  80.             $visitReportsAwardedDotation->addAwardedDotation($this);
  81.         }
  82.         return $this;
  83.     }
  84.     public function removeVisitReportsAwardedDotation(VisitReport $visitReportsAwardedDotation): static
  85.     {
  86.         if ($this->visitReportsAwardedDotations->removeElement($visitReportsAwardedDotation)) {
  87.             $visitReportsAwardedDotation->removeAwardedDotation($this);
  88.         }
  89.         return $this;
  90.     }
  91. }