src/Entity/Voucher.php line 15

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use ApiPlatform\Core\Annotation\ApiResource;
  4. use App\Repository\VoucherRepository;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\DBAL\Types\Types;
  8. use Doctrine\ORM\Mapping as ORM;
  9. #[ORM\Entity(repositoryClassVoucherRepository::class)]
  10. #[ApiResource]
  11. class Voucher
  12. {
  13.     #[ORM\Id]
  14.     #[ORM\GeneratedValue]
  15.     #[ORM\Column]
  16.     private ?int $id null;
  17.     #[ORM\Column(length255nullabletrue)]
  18.     private ?string $code null;
  19.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  20.     private ?\DateTimeInterface $date null;
  21.     #[ORM\Column(length255nullabletrue)]
  22.     private ?string $etat null;
  23.     #[ORM\ManyToOne(inversedBy'vouchers')]
  24.     private ?Offresinscrit $userinscrit null;
  25.     #[ORM\ManyToOne(inversedBy'voucher')]
  26.     private ?Offres $offres null;
  27.     #[ORM\OneToMany(mappedBy'voucher'targetEntityUtilisation::class,cascade: ['remove'])]
  28.     private Collection $utilisations;
  29.     #[ORM\Column(length255nullabletrue)]
  30.     private ?string $partner null;
  31.     public function __construct()
  32.     {
  33.         $this->utilisations = new ArrayCollection();
  34.     }
  35.     public function getId(): ?int
  36.     {
  37.         return $this->id;
  38.     }
  39.     public function getCode(): ?string
  40.     {
  41.         return $this->code;
  42.     }
  43.     public function setCode(?string $code): self
  44.     {
  45.         $this->code $code;
  46.         return $this;
  47.     }
  48.     public function getDate(): ?\DateTimeInterface
  49.     {
  50.         return $this->date;
  51.     }
  52.     public function setDate(?\DateTimeInterface $date): self
  53.     {
  54.         $this->date $date;
  55.         return $this;
  56.     }
  57.     public function getEtat(): ?string
  58.     {
  59.         return $this->etat;
  60.     }
  61.     public function setEtat(?string $etat): self
  62.     {
  63.         $this->etat $etat;
  64.         return $this;
  65.     }
  66.     public function getUserinscrit(): ?Offresinscrit
  67.     {
  68.         return $this->userinscrit;
  69.     }
  70.     public function setUserinscrit(?Offresinscrit $userinscrit): self
  71.     {
  72.         $this->userinscrit $userinscrit;
  73.         return $this;
  74.     }
  75.     public function getOffres(): ?Offres
  76.     {
  77.         return $this->offres;
  78.     }
  79.     public function setOffres(?Offres $offres): self
  80.     {
  81.         $this->offres $offres;
  82.         return $this;
  83.     }
  84.     /**
  85.      * @return Collection<int, Utilisation>
  86.      */
  87.     public function getUtilisations(): Collection
  88.     {
  89.         return $this->utilisations;
  90.     }
  91.     public function addUtilisation(Utilisation $utilisation): self
  92.     {
  93.         if (!$this->utilisations->contains($utilisation)) {
  94.             $this->utilisations->add($utilisation);
  95.             $utilisation->setVoucher($this);
  96.         }
  97.         return $this;
  98.     }
  99.     public function removeUtilisation(Utilisation $utilisation): self
  100.     {
  101.         if ($this->utilisations->removeElement($utilisation)) {
  102.             // set the owning side to null (unless already changed)
  103.             if ($utilisation->getVoucher() === $this) {
  104.                 $utilisation->setVoucher(null);
  105.             }
  106.         }
  107.         return $this;
  108.     }
  109.     public function getPartner(): ?string
  110.     {
  111.         return $this->partner;
  112.     }
  113.     public function setPartner(?string $partner): self
  114.     {
  115.         $this->partner $partner;
  116.         return $this;
  117.     }
  118. }