src/Entity/Inscription.php line 17

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\InscriptionRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\DBAL\Types\Types;
  7. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  8. use Symfony\Component\HttpFoundation\File\File;
  9. use Doctrine\ORM\Mapping as ORM;
  10. use Symfony\Component\Validator\Constraints as Assert;
  11. #[ORM\Entity(repositoryClassInscriptionRepository::class)]
  12. #[Vich\Uploadable]
  13. class Inscription
  14. {
  15.     #[ORM\Id]
  16.     #[ORM\GeneratedValue]
  17.     #[ORM\Column]
  18.     private ?int $id null;
  19.     #[ORM\ManyToOne(inversedBy'inscriptions')]
  20.     #[Assert\NotBlank(message"Le champ ne peut pas ĂȘtre vide.")]
  21.     private ?User $candidat null;
  22.     #[ORM\ManyToOne(inversedBy'inscriptions')]
  23.     #[Assert\NotBlank(message"Le champ ne peut pas ĂȘtre vide.")]
  24.     private ?Cycle $cycle null;
  25.     #[ORM\OneToMany(mappedBy'inscription'targetEntityFactureCandidat::class)]
  26.     private Collection $factureCandidats;
  27.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  28.     private ?\DateTimeInterface $dateCreation null;
  29.     #[ORM\Column(length255nullabletrue)]
  30.     private ?string $attestation null;
  31.     #[Vich\UploadableField(mapping'attestation'fileNameProperty'attestation')]
  32.     public $attestationFile;
  33.     #[ORM\Column(length255nullabletrue)]
  34.     private ?string $groupe null;
  35.     #[ORM\ManyToOne(inversedBy'inscriptions')]
  36.     #[ORM\JoinColumn(nullablefalse)]
  37.     private ?Session $session null;
  38.     #[ORM\OneToMany(mappedBy'inscription'targetEntityInscriptionModule::class, cascade: ["persist"])]
  39.     private Collection $inscriptionModules;
  40.     public function __construct()
  41.     {
  42.         $this->factureCandidats = new ArrayCollection();
  43.         $this->inscriptionModules = new ArrayCollection();
  44.     }
  45.     public function __toString()
  46.     {
  47.         // return 'Candidat:' .
  48.         //     $this->getCandidat()->getUserIdentifier() .
  49.         //     ' / Session:' .
  50.         //     $this->getSession()->getLibele();
  51.         return 'Candidat:' .
  52.             $this->getCandidat()->getUserIdentifier();
  53.     }
  54.     public function setAttestationFile(File $attestationFile null)
  55.     {
  56.         $this->attestationFile $attestationFile;
  57.     }
  58.     public function getAttestationFile()
  59.     {
  60.         return $this->attestationFile;
  61.     }
  62.     public function getId(): ?int
  63.     {
  64.         return $this->id;
  65.     }
  66.     public function getCandidat(): ?User
  67.     {
  68.         return $this->candidat;
  69.     }
  70.     public function setCandidat(?User $candidat): self
  71.     {
  72.         $this->candidat $candidat;
  73.         return $this;
  74.     }
  75.     public function getCycle(): ?Cycle
  76.     {
  77.         return $this->cycle;
  78.     }
  79.     public function setCycle(?Cycle $cycle): self
  80.     {
  81.         $this->cycle $cycle;
  82.         return $this;
  83.     }
  84.     /**
  85.      * @return Collection<int, FactureCandidat>
  86.      */
  87.     public function getFactureCandidats(): Collection
  88.     {
  89.         return $this->factureCandidats;
  90.     }
  91.     public function addFactureCandidat(FactureCandidat $factureCandidat): self
  92.     {
  93.         if (!$this->factureCandidats->contains($factureCandidat)) {
  94.             $this->factureCandidats->add($factureCandidat);
  95.             $factureCandidat->setInscription($this);
  96.         }
  97.         return $this;
  98.     }
  99.     public function removeFactureCandidat(
  100.         FactureCandidat $factureCandidat
  101.     ): self {
  102.         if ($this->factureCandidats->removeElement($factureCandidat)) {
  103.             // set the owning side to null (unless already changed)
  104.             if ($factureCandidat->getInscription() === $this) {
  105.                 $factureCandidat->setInscription(null);
  106.             }
  107.         }
  108.         return $this;
  109.     }
  110.     public function getDateCreation(): ?\DateTimeInterface
  111.     {
  112.         return $this->dateCreation;
  113.     }
  114.     public function setDateCreation(?\DateTimeInterface $dateCreation): self
  115.     {
  116.         $this->dateCreation $dateCreation;
  117.         return $this;
  118.     }
  119.     public function getAttestation(): ?string
  120.     {
  121.         return $this->attestation;
  122.     }
  123.     public function setAttestation(?string $attestation): self
  124.     {
  125.         $this->attestation $attestation;
  126.         return $this;
  127.     }
  128.     public function getGroupe(): ?string
  129.     {
  130.         return $this->groupe;
  131.     }
  132.     public function setGroupe(?string $groupe): self
  133.     {
  134.         $this->groupe $groupe;
  135.         return $this;
  136.     }
  137.     public function getSession(): ?Session
  138.     {
  139.         return $this->session;
  140.     }
  141.     public function setSession(?Session $session): self
  142.     {
  143.         $this->session $session;
  144.         return $this;
  145.     }
  146.     /**
  147.      * @return Collection<int, InscriptionModule>
  148.      */
  149.     public function getInscriptionModules(): Collection
  150.     {
  151.         return $this->inscriptionModules;
  152.     }
  153.     public function addInscriptionModule(
  154.         InscriptionModule $inscriptionModule
  155.     ): self {
  156.         if (!$this->inscriptionModules->contains($inscriptionModule)) {
  157.             $this->inscriptionModules->add($inscriptionModule);
  158.             $inscriptionModule->setInscription($this);
  159.         }
  160.         return $this;
  161.     }
  162.     public function removeInscriptionModule(
  163.         InscriptionModule $inscriptionModule
  164.     ): self {
  165.         if ($this->inscriptionModules->removeElement($inscriptionModule)) {
  166.             // set the owning side to null (unless already changed)
  167.             if ($inscriptionModule->getInscription() === $this) {
  168.                 $inscriptionModule->setInscription(null);
  169.             }
  170.         }
  171.         return $this;
  172.     }
  173. }