<?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\ChapitreFormationRepository::class)]
class ChapitreFormation
{
#[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 $contenu;
#[ORM\ManyToOne(targetEntity: \App\Entity\User::class, inversedBy: 'chapitresFormation')]
private $user;
#[ORM\JoinColumn(nullable: false)]
#[ORM\ManyToOne(targetEntity: \App\Entity\Formation::class, inversedBy: 'chapitres')]
private $formation;
#[ORM\Column(type: 'datetime')]
private $created_at;
#[ORM\Column(type: 'datetime', nullable: true)]
private $updated_at;
#[ORM\Column(type: 'boolean')]
private $status;
#[ORM\OneToMany(targetEntity: \App\Entity\FichierFormation::class, mappedBy: 'chapitre', orphanRemoval: true)]
private $fichiers;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private $duree;
public function __construct()
{
$this->created_at=new \DateTime();
$this->status=false;
$this->fichiers = 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 getContenu(): ?string
{
return $this->contenu;
}
public function setContenu(?string $contenu): self
{
$this->contenu = $contenu;
return $this;
}
public function getUser(): ?User
{
return $this->user;
}
public function setUser(?User $user): self
{
$this->user = $user;
return $this;
}
public function getFormation(): ?Formation
{
return $this->formation;
}
public function setFormation(?Formation $formation): self
{
$this->formation = $formation;
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 getStatus(): ?bool
{
return $this->status;
}
public function setStatus(bool $status): self
{
$this->status = $status;
return $this;
}
/**
* @return Collection|FichierFormation[]
*/
public function getFichiers(): Collection
{
return $this->fichiers;
}
public function addFichier(FichierFormation $fichier): self
{
if (!$this->fichiers->contains($fichier)) {
$this->fichiers[] = $fichier;
$fichier->setChapitre($this);
}
return $this;
}
public function removeFichier(FichierFormation $fichier): self
{
if ($this->fichiers->contains($fichier)) {
$this->fichiers->removeElement($fichier);
// set the owning side to null (unless already changed)
if ($fichier->getChapitre() === $this) {
$fichier->setChapitre(null);
}
}
return $this;
}
public function getDuree(): ?string
{
return $this->duree;
}
public function setDuree(?string $duree): self
{
$this->duree = $duree;
return $this;
}
}