<?php
namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass="App\Repository\FormationRepository")
*/
class Formation
{
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
*/
private $titre;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $description;
/**
* @ORM\Column(type="float", nullable=true)
*/
private $prix;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $image;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $video;
/**
* @ORM\Column(type="integer")
*/
private $niveau;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $objectif;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $atouts;
/**
* @ORM\Column(type="boolean")
*/
private $status;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $duree;
/* @ORM\Column(type="datetime", nullable=true)
*/
//private $date_debut;
/* @ORM\Column(type="datetime", nullable=true)
*/
//private $date_fin;
/*@ORM\Column(type="string", length=255, nullable=true)
*/
//private $lieu;
/**
* @ORM\Column(type="datetime")
*/
private $created_at;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $updated_at;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\User", inversedBy="formations")
* @ORM\JoinColumn(nullable=false)
*/
private $user;
/* @ORM\Column(type="integer")
*/
//private $type;
/**
* @ORM\ManyToMany(targetEntity="App\Entity\Formateur", inversedBy="formations")
*/
private $formateur;
/**
* @ORM\ManyToMany(targetEntity="App\Entity\CategorieFormation", inversedBy="formations")
*/
private $categorie;
/**
* @ORM\OneToMany(targetEntity="App\Entity\ChapitreFormation", mappedBy="formation", orphanRemoval=true)
*/
private $chapitres;
/**
* @ORM\ManyToMany(targetEntity="App\Entity\Organisateur", inversedBy="formations")
*/
private $organisateur;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $divers;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $langue;
/**
* @ORM\OneToMany(targetEntity="App\Entity\ProgrammeFormation", mappedBy="formation", orphanRemoval=true)
*/
private $programmes;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $min;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $max;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $document;
const lang_long=['FR'=>"Français",'EN'=>"Anglais"],
niveau_long=["Débutant","Intermédiaire","Expert"]
;
public function getVideoId(){
return str_replace(['https://','http://','www.','youtube.com/watch','?','v='],'',$this->video);
}
public function getFullLang(){
return self::lang_long[$this->langue];
}
public function getFullNiveau(){
return self::niveau_long[$this->niveau];
}
public function __construct()
{
$this->created_at=new \DateTime();
$this->status=false;
$this->formateur = new ArrayCollection();
$this->categorie = new ArrayCollection();
$this->chapitres = new ArrayCollection();
$this->organisateur = new ArrayCollection();
$this->programmes = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getTitre(): ?string
{
return $this->titre;
}
public function setTitre(string $titre): self
{
$this->titre = $titre;
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(?string $description): self
{
$this->description = $description;
return $this;
}
public function getPrix(): ?float
{
return $this->prix;
}
public function setPrix(?float $prix): self
{
$this->prix = $prix;
return $this;
}
public function getImage(): ?string
{
return $this->image;
}
public function setImage(?string $image): self
{
$this->image = $image;
return $this;
}
public function getVideo(): ?string
{
return $this->video;
}
public function setVideo(?string $video): self
{
$this->video = $video;
return $this;
}
public function getNiveau(): ?int
{
return $this->niveau;
}
public function setNiveau(int $niveau): self
{
$this->niveau = $niveau;
return $this;
}
public function getObjectif(): ?string
{
return $this->objectif;
}
public function setObjectif(?string $objectif): self
{
$this->objectif = $objectif;
return $this;
}
public function getAtouts(): ?string
{
return $this->atouts;
}
public function setAtouts(?string $atouts): self
{
$this->atouts = $atouts;
return $this;
}
public function getStatus(): ?bool
{
return $this->status;
}
public function setStatus(bool $status): self
{
$this->status = $status;
return $this;
}
public function getDuree(): ?string
{
return $this->duree;
}
public function setDuree(?string $duree): self
{
$this->duree = $duree;
return $this;
}
/*public function getDateDebut(): ?\DateTimeInterface
{
return $this->date_debut;
}
public function setDateDebut(?\DateTimeInterface $date_debut): self
{
$this->date_debut = $date_debut;
return $this;
}
public function getDateFin(): ?\DateTimeInterface
{
return $this->date_fin;
}
public function setDateFin(?\DateTimeInterface $date_fin): self
{
$this->date_fin = $date_fin;
return $this;
}
public function getLieu(): ?string
{
return $this->lieu;
}
public function setLieu(?string $lieu): self
{
$this->lieu = $lieu;
return $this;
}*/
public function getCreatedAt(): ?\DateTimeInterface
{
return $this->created_at;
}
public function setCreatedAt(\DateTimeInterface $created_at): self
{
$this->created_at = $created_at;
return $this;
}
public function getUpdatedAt(): ?\DateTimeInterface
{
return $this->updated_at;
}
public function setUpdatedAt(?\DateTimeInterface $updated_at): self
{
$this->updated_at = $updated_at;
return $this;
}
public function getUser(): ?User
{
return $this->user;
}
public function setUser(?User $user): self
{
$this->user = $user;
return $this;
}
/*public function getType(): ?int
{
return $this->type;
}
public function setType(int $type): self
{
$this->type = $type;
return $this;
}*/
/**
* @return Collection|Formateur[]
*/
public function getFormateur(): Collection
{
return $this->formateur;
}
public function addFormateur(Formateur $formateur): self
{
if (!$this->formateur->contains($formateur)) {
$this->formateur[] = $formateur;
}
return $this;
}
public function removeFormateur(Formateur $formateur): self
{
if ($this->formateur->contains($formateur)) {
$this->formateur->removeElement($formateur);
}
return $this;
}
/**
* @return Collection|CategorieFormation[]
*/
public function getCategorie(): Collection
{
return $this->categorie;
}
public function addCategorie(CategorieFormation $categorie): self
{
if (!$this->categorie->contains($categorie)) {
$this->categorie[] = $categorie;
}
return $this;
}
public function removeCategorie(CategorieFormation $categorie): self
{
if ($this->categorie->contains($categorie)) {
$this->categorie->removeElement($categorie);
}
return $this;
}
/**
* @return Collection|ChapitreFormation[]
*/
public function getChapitres(): Collection
{
return $this->chapitres;
}
public function addChapitre(ChapitreFormation $chapitre): self
{
if (!$this->chapitres->contains($chapitre)) {
$this->chapitres[] = $chapitre;
$chapitre->setFormation($this);
}
return $this;
}
public function removeChapitre(ChapitreFormation $chapitre): self
{
if ($this->chapitres->contains($chapitre)) {
$this->chapitres->removeElement($chapitre);
// set the owning side to null (unless already changed)
if ($chapitre->getFormation() === $this) {
$chapitre->setFormation(null);
}
}
return $this;
}
/**
* @return Collection|Organisateur[]
*/
public function getOrganisateur(): Collection
{
return $this->organisateur;
}
public function addOrganisateur(Organisateur $organisateur): self
{
if (!$this->organisateur->contains($organisateur)) {
$this->organisateur[] = $organisateur;
}
return $this;
}
public function removeOrganisateur(Organisateur $organisateur): self
{
if ($this->organisateur->contains($organisateur)) {
$this->organisateur->removeElement($organisateur);
}
return $this;
}
public function getDivers(): ?string
{
return $this->divers;
}
public function setDivers(?string $divers): self
{
$this->divers = $divers;
return $this;
}
public function getLangue(): ?string
{
return $this->langue;
}
public function setLangue(?string $langue): self
{
$this->langue = $langue;
return $this;
}
/**
* @return Collection|ProgrammeFormation[]
*/
public function getProgrammes(): Collection
{
return $this->programmes;
}
public function addProgramme(ProgrammeFormation $programme): self
{
if (!$this->programmes->contains($programme)) {
$this->programmes[] = $programme;
$programme->setFormation($this);
}
return $this;
}
public function removeProgramme(ProgrammeFormation $programme): self
{
if ($this->programmes->contains($programme)) {
$this->programmes->removeElement($programme);
// set the owning side to null (unless already changed)
if ($programme->getFormation() === $this) {
$programme->setFormation(null);
}
}
return $this;
}
public function getMin(): ?string
{
return $this->min;
}
public function setMin(?string $min): self
{
$this->min = $min;
return $this;
}
public function getMax(): ?string
{
return $this->max;
}
public function setMax(?string $max): self
{
$this->max = $max;
return $this;
}
public function getDocument(): ?string
{
return $this->document;
}
public function setDocument(?string $document): self
{
$this->document = $document;
return $this;
}
}