src\Entity\Formation.php line 10

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\ORM\Mapping as ORM;
  6. #[ORM\Entity(repositoryClass\App\Repository\FormationRepository::class)]
  7. class Formation
  8. {
  9.     #[ORM\Id]
  10.     #[ORM\GeneratedValue]
  11.     #[ORM\Column(type'integer')]
  12.     private $id;
  13.     #[ORM\Column(type'string'length255)]
  14.     private $titre;
  15.     #[ORM\Column(type'text'nullabletrue)]
  16.     private $description;
  17.     #[ORM\Column(type'float'nullabletrue)]
  18.     private $prix;
  19.     #[ORM\Column(type'string'length255nullabletrue)]
  20.     private $image;
  21.     #[ORM\Column(type'string'length255nullabletrue)]
  22.     private $video;
  23.     #[ORM\Column(type'integer')]
  24.     private $niveau;
  25.     #[ORM\Column(type'text'nullabletrue)]
  26.     private $objectif;
  27.     #[ORM\Column(type'text'nullabletrue)]
  28.     private $atouts;
  29.     #[ORM\Column(type'boolean')]
  30.     private $status;
  31.     #[ORM\Column(type'string'length255nullabletrue)]
  32.     private $duree;
  33.     /* @ORM\Column(type="datetime", nullable=true)
  34.      */
  35.     //private $date_debut;
  36.     /* @ORM\Column(type="datetime", nullable=true)
  37.      */
  38.     //private $date_fin;
  39.     /*@ORM\Column(type="string", length=255, nullable=true)
  40.      */
  41.     //private $lieu;
  42.     #[ORM\Column(type'datetime')]
  43.     private $created_at;
  44.     #[ORM\Column(type'datetime'nullabletrue)]
  45.     private $updated_at;
  46.     #[ORM\JoinColumn(nullablefalse)]
  47.     #[ORM\ManyToOne(targetEntity\App\Entity\User::class, inversedBy'formations')]
  48.     private $user;
  49.     /* @ORM\Column(type="integer")
  50.      */
  51.     //private $type;
  52.     #[ORM\ManyToMany(targetEntity\App\Entity\Formateur::class, inversedBy'formations')]
  53.     private $formateur;
  54.     #[ORM\ManyToMany(targetEntity\App\Entity\CategorieFormation::class, inversedBy'formations')]
  55.     private $categorie;
  56.     #[ORM\OneToMany(targetEntity\App\Entity\ChapitreFormation::class, mappedBy'formation'orphanRemovaltrue)]
  57.     private $chapitres;
  58.     #[ORM\ManyToMany(targetEntity\App\Entity\Organisateur::class, inversedBy'formations')]
  59.     private $organisateur;
  60.     #[ORM\Column(type'text'nullabletrue)]
  61.     private $divers;
  62.     #[ORM\Column(type'string'length255nullabletrue)]
  63.     private $langue;
  64.     #[ORM\OneToMany(targetEntity\App\Entity\ProgrammeFormation::class, mappedBy'formation'orphanRemovaltrue)]
  65.     private $programmes;
  66.     #[ORM\Column(type'string'length255nullabletrue)]
  67.     private $min;
  68.     #[ORM\Column(type'string'length255nullabletrue)]
  69.     private $max;
  70.     #[ORM\Column(type'string'length255nullabletrue)]
  71.     private $document;
  72.     const lang_long=['FR'=>"Français",'EN'=>"Anglais"],
  73.     niveau_long=["Débutant","Intermédiaire","Expert"]
  74.     ;
  75.     public function getVideoId(){
  76.         return str_replace(['https://','http://','www.','youtube.com/watch','?','v='],'',$this->video);
  77.     }
  78.     public function getFullLang(){
  79.         return self::lang_long[$this->langue];
  80.     }
  81.     public function getFullNiveau(){
  82.         return self::niveau_long[$this->niveau];
  83.     }
  84.     public function __construct()
  85.     {
  86.         $this->created_at=new \DateTime();
  87.         $this->status=false;
  88.         $this->formateur = new ArrayCollection();
  89.         $this->categorie = new ArrayCollection();
  90.         $this->chapitres = new ArrayCollection();
  91.         $this->organisateur = new ArrayCollection();
  92.         $this->programmes = new ArrayCollection();
  93.     }
  94.     public function getId(): ?int
  95.     {
  96.         return $this->id;
  97.     }
  98.     public function getTitre(): ?string
  99.     {
  100.         return $this->titre;
  101.     }
  102.     public function setTitre(string $titre): self
  103.     {
  104.         $this->titre $titre;
  105.         return $this;
  106.     }
  107.     public function getDescription(): ?string
  108.     {
  109.         return $this->description;
  110.     }
  111.     public function setDescription(?string $description): self
  112.     {
  113.         $this->description $description;
  114.         return $this;
  115.     }
  116.     public function getPrix(): ?float
  117.     {
  118.         return $this->prix;
  119.     }
  120.     public function setPrix(?float $prix): self
  121.     {
  122.         $this->prix $prix;
  123.         return $this;
  124.     }
  125.     public function getImage(): ?string
  126.     {
  127.         return $this->image;
  128.     }
  129.     public function setImage(?string $image): self
  130.     {
  131.         $this->image $image;
  132.         return $this;
  133.     }
  134.     public function getVideo(): ?string
  135.     {
  136.         return $this->video;
  137.     }
  138.     public function setVideo(?string $video): self
  139.     {
  140.         $this->video $video;
  141.         return $this;
  142.     }
  143.     public function getNiveau(): ?int
  144.     {
  145.         return $this->niveau;
  146.     }
  147.     public function setNiveau(int $niveau): self
  148.     {
  149.         $this->niveau $niveau;
  150.         return $this;
  151.     }
  152.     public function getObjectif(): ?string
  153.     {
  154.         return $this->objectif;
  155.     }
  156.     public function setObjectif(?string $objectif): self
  157.     {
  158.         $this->objectif $objectif;
  159.         return $this;
  160.     }
  161.     public function getAtouts(): ?string
  162.     {
  163.         return $this->atouts;
  164.     }
  165.     public function setAtouts(?string $atouts): self
  166.     {
  167.         $this->atouts $atouts;
  168.         return $this;
  169.     }
  170.     public function getStatus(): ?bool
  171.     {
  172.         return $this->status;
  173.     }
  174.     public function setStatus(bool $status): self
  175.     {
  176.         $this->status $status;
  177.         return $this;
  178.     }
  179.     public function getDuree(): ?string
  180.     {
  181.         return $this->duree;
  182.     }
  183.     public function setDuree(?string $duree): self
  184.     {
  185.         $this->duree $duree;
  186.         return $this;
  187.     }
  188.     /*public function getDateDebut(): ?\DateTimeInterface
  189.     {
  190.         return $this->date_debut;
  191.     }
  192.     public function setDateDebut(?\DateTimeInterface $date_debut): self
  193.     {
  194.         $this->date_debut = $date_debut;
  195.         return $this;
  196.     }
  197.     public function getDateFin(): ?\DateTimeInterface
  198.     {
  199.         return $this->date_fin;
  200.     }
  201.     public function setDateFin(?\DateTimeInterface $date_fin): self
  202.     {
  203.         $this->date_fin = $date_fin;
  204.         return $this;
  205.     }
  206.     public function getLieu(): ?string
  207.     {
  208.         return $this->lieu;
  209.     }
  210.     public function setLieu(?string $lieu): self
  211.     {
  212.         $this->lieu = $lieu;
  213.         return $this;
  214.     }*/
  215.     public function getCreatedAt(): ?\DateTimeInterface
  216.     {
  217.         return $this->created_at;
  218.     }
  219.     public function setCreatedAt(\DateTimeInterface $created_at): self
  220.     {
  221.         $this->created_at $created_at;
  222.         return $this;
  223.     }
  224.     public function getUpdatedAt(): ?\DateTimeInterface
  225.     {
  226.         return $this->updated_at;
  227.     }
  228.     public function setUpdatedAt(?\DateTimeInterface $updated_at): self
  229.     {
  230.         $this->updated_at $updated_at;
  231.         return $this;
  232.     }
  233.     public function getUser(): ?User
  234.     {
  235.         return $this->user;
  236.     }
  237.     public function setUser(?User $user): self
  238.     {
  239.         $this->user $user;
  240.         return $this;
  241.     }
  242.     /*public function getType(): ?int
  243.     {
  244.         return $this->type;
  245.     }
  246.     public function setType(int $type): self
  247.     {
  248.         $this->type = $type;
  249.         return $this;
  250.     }*/
  251.     /**
  252.      * @return Collection|Formateur[]
  253.      */
  254.     public function getFormateur(): Collection
  255.     {
  256.         return $this->formateur;
  257.     }
  258.     public function addFormateur(Formateur $formateur): self
  259.     {
  260.         if (!$this->formateur->contains($formateur)) {
  261.             $this->formateur[] = $formateur;
  262.         }
  263.         return $this;
  264.     }
  265.     public function removeFormateur(Formateur $formateur): self
  266.     {
  267.         if ($this->formateur->contains($formateur)) {
  268.             $this->formateur->removeElement($formateur);
  269.         }
  270.         return $this;
  271.     }
  272.     /**
  273.      * @return Collection|CategorieFormation[]
  274.      */
  275.     public function getCategorie(): Collection
  276.     {
  277.         return $this->categorie;
  278.     }
  279.     public function addCategorie(CategorieFormation $categorie): self
  280.     {
  281.         if (!$this->categorie->contains($categorie)) {
  282.             $this->categorie[] = $categorie;
  283.         }
  284.         return $this;
  285.     }
  286.     public function removeCategorie(CategorieFormation $categorie): self
  287.     {
  288.         if ($this->categorie->contains($categorie)) {
  289.             $this->categorie->removeElement($categorie);
  290.         }
  291.         return $this;
  292.     }
  293.     /**
  294.      * @return Collection|ChapitreFormation[]
  295.      */
  296.     public function getChapitres(): Collection
  297.     {
  298.         return $this->chapitres;
  299.     }
  300.     public function addChapitre(ChapitreFormation $chapitre): self
  301.     {
  302.         if (!$this->chapitres->contains($chapitre)) {
  303.             $this->chapitres[] = $chapitre;
  304.             $chapitre->setFormation($this);
  305.         }
  306.         return $this;
  307.     }
  308.     public function removeChapitre(ChapitreFormation $chapitre): self
  309.     {
  310.         if ($this->chapitres->contains($chapitre)) {
  311.             $this->chapitres->removeElement($chapitre);
  312.             // set the owning side to null (unless already changed)
  313.             if ($chapitre->getFormation() === $this) {
  314.                 $chapitre->setFormation(null);
  315.             }
  316.         }
  317.         return $this;
  318.     }
  319.     /**
  320.      * @return Collection|Organisateur[]
  321.      */
  322.     public function getOrganisateur(): Collection
  323.     {
  324.         return $this->organisateur;
  325.     }
  326.     public function addOrganisateur(Organisateur $organisateur): self
  327.     {
  328.         if (!$this->organisateur->contains($organisateur)) {
  329.             $this->organisateur[] = $organisateur;
  330.         }
  331.         return $this;
  332.     }
  333.     public function removeOrganisateur(Organisateur $organisateur): self
  334.     {
  335.         if ($this->organisateur->contains($organisateur)) {
  336.             $this->organisateur->removeElement($organisateur);
  337.         }
  338.         return $this;
  339.     }
  340.     public function getDivers(): ?string
  341.     {
  342.         return $this->divers;
  343.     }
  344.     public function setDivers(?string $divers): self
  345.     {
  346.         $this->divers $divers;
  347.         return $this;
  348.     }
  349.     public function getLangue(): ?string
  350.     {
  351.         return $this->langue;
  352.     }
  353.     public function setLangue(?string $langue): self
  354.     {
  355.         $this->langue $langue;
  356.         return $this;
  357.     }
  358.     /**
  359.      * @return Collection|ProgrammeFormation[]
  360.      */
  361.     public function getProgrammes(): Collection
  362.     {
  363.         return $this->programmes;
  364.     }
  365.     public function addProgramme(ProgrammeFormation $programme): self
  366.     {
  367.         if (!$this->programmes->contains($programme)) {
  368.             $this->programmes[] = $programme;
  369.             $programme->setFormation($this);
  370.         }
  371.         return $this;
  372.     }
  373.     public function removeProgramme(ProgrammeFormation $programme): self
  374.     {
  375.         if ($this->programmes->contains($programme)) {
  376.             $this->programmes->removeElement($programme);
  377.             // set the owning side to null (unless already changed)
  378.             if ($programme->getFormation() === $this) {
  379.                 $programme->setFormation(null);
  380.             }
  381.         }
  382.         return $this;
  383.     }
  384.     public function getMin(): ?string
  385.     {
  386.         return $this->min;
  387.     }
  388.     public function setMin(?string $min): self
  389.     {
  390.         $this->min $min;
  391.         return $this;
  392.     }
  393.     public function getMax(): ?string
  394.     {
  395.         return $this->max;
  396.     }
  397.     public function setMax(?string $max): self
  398.     {
  399.         $this->max $max;
  400.         return $this;
  401.     }
  402.     public function getDocument(): ?string
  403.     {
  404.         return $this->document;
  405.     }
  406.     public function setDocument(?string $document): self
  407.     {
  408.         $this->document $document;
  409.         return $this;
  410.     }
  411. }