src/Entity/Gestiform/Formations/Session/FormateurEvent.php line 17

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Gestiform\Formations\Session;
  3. use App\Entity\AbstractEntity;
  4. use App\Entity\Common\Upload;
  5. use App\Entity\Gestiform\Formations\Session\Planning\Event;
  6. use App\Entity\Gestiform\Users\Formateur;
  7. use App\Repository\Gestiform\Formations\Session\FormateurEventRepository;
  8. use Doctrine\Common\Collections\ArrayCollection;
  9. use Doctrine\Common\Collections\Collection;
  10. use Doctrine\ORM\Mapping as ORM;
  11. /**
  12.  * @ORM\Entity(repositoryClass=FormateurEventRepository::class)
  13.  */
  14. class FormateurEvent extends AbstractEntity
  15. {
  16.     /**
  17.      * @ORM\Column(type="decimal", precision=10, nullable=true)
  18.      */
  19.     private ?int $nbjoursPrevus null;
  20.     /**
  21.      * @ORM\Column(type="string", length=255, nullable=true)
  22.      */
  23.     private ?string $consigne null;
  24.     /**
  25.      * @ORM\ManyToOne(targetEntity=Formateur::class, inversedBy="formateurEvents")
  26.      */
  27.     private ?Formateur $formateur null;
  28.     /**
  29.      * @ORM\ManyToOne(targetEntity=Event::class, inversedBy="formateurEvents")
  30.      */
  31.     private ?Event $evenement null;
  32.     /**
  33.      * @ORM\ManyToMany(targetEntity=Upload::class,cascade={"all"})
  34.      */
  35.     private Collection $files;
  36.     /**
  37.      * @ORM\Column(type="json", nullable=true)
  38.      */
  39.     private ?array $eventChilds null;
  40.     /**
  41.     * @ORM\Column(type="boolean", nullable=true)
  42.     */
  43.     private ?bool $sendconvocation null;
  44.     public function __construct()
  45.     {
  46.         $this->files = new ArrayCollection();
  47.     }
  48.     public function getEventChilds(): array
  49.     {
  50.         return $this->eventChilds ?? [];
  51.     }
  52.     public function addEventChild(string $idEventstring $intitule): self
  53.     {
  54.         $data $this->getEventChilds();
  55.         $exist false;
  56.         foreach ($data as &$item) {
  57.             if ($item['idEvent'] === $idEvent) {
  58.                 $item['intitule'] = $intitule;
  59.                 $exist true;
  60.                 break;
  61.             }
  62.         }
  63.         if (!$exist) {
  64.             $data[] = [
  65.                 'idEvent' => $idEvent,
  66.                 'intitule' => $intitule,
  67.             ];
  68.         }
  69.         $this->eventChilds $data;
  70.         return $this;
  71.     }
  72.     public function removeEventChild(string $idEvent): self
  73.     {
  74.         $data $this->getEventChilds();
  75.         foreach ($data as $key => $item) {
  76.             if ($item['idEvent'] === $idEvent) {
  77.                 unset($data[$key]);
  78.             }
  79.         }
  80.         $this->eventChilds array_values($data);
  81.         return $this;
  82.     }
  83.     public function clearEventChilds(): self
  84.     {
  85.         $this->eventChilds = [];
  86.         return $this;
  87.     }
  88.     public function getNbjoursPrevus(): ?string
  89.     {
  90.         return $this->nbjoursPrevus;
  91.     }
  92.     public function setNbjoursPrevus(?string $nbjoursPrevus): self
  93.     {
  94.         $this->nbjoursPrevus $nbjoursPrevus;
  95.         return $this;
  96.     }
  97.     public function getFormateur(): ?Formateur
  98.     {
  99.         return $this->formateur;
  100.     }
  101.     public function setFormateur(?Formateur $formateur): self
  102.     {
  103.         $this->formateur $formateur;
  104.         return $this;
  105.     }
  106.     public function getEvenement(): ?Event
  107.     {
  108.         return $this->evenement;
  109.     }
  110.     public function setEvenement(?Event $evenement): self
  111.     {
  112.         $this->evenement $evenement;
  113.         return $this;
  114.     }
  115.     public function getConsigne(): ?string
  116.     {
  117.         return $this->consigne;
  118.     }
  119.     public function setConsigne(?string $consigne): self
  120.     {
  121.         $this->consigne $consigne;
  122.         return $this;
  123.     }
  124.     public function setEventChilds(?array $eventChilds): self
  125.     {
  126.         $this->eventChilds $eventChilds;
  127.         return $this;
  128.     }
  129.     /**
  130.      * @return Collection<int, Upload>
  131.      */
  132.     public function getFiles(): Collection
  133.     {
  134.         return $this->files;
  135.     }
  136.     public function addFile(Upload $file): self
  137.     {
  138.         if (!$this->files->contains($file)) {
  139.             $this->files->add($file);
  140.         }
  141.         return $this;
  142.     }
  143.     public function removeFile(Upload $file): self
  144.     {
  145.         $this->files->removeElement($file);
  146.         return $this;
  147.     }
  148.     
  149.     public function getSendconvocation(): ?bool
  150.     {
  151.         return $this->sendconvocation;
  152.     }
  153.     public function setSendconvocation(?bool $sendconvocation): self
  154.     {
  155.         $this->sendconvocation $sendconvocation;
  156.         return $this;
  157.     }
  158. }