<?php
namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Vich\UploadableField;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\HttpFoundation\File\File;
use Vich\UploaderBundle\Mapping\Annotation as Vich;
use App\Repository\SessionsformationRepository;
use Symfony\Component\Validator\Constraints as Assert;
#[ORM\Entity(repositoryClass: SessionsformationRepository::class)]
class Sessionsformation
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column,Assert\Positive]
private ?int $numsession = null;
#[ORM\Column(length: 255)]
private ?string $titre = null;
#[ORM\Column(type: Types::DATE_MUTABLE),
Assert\LessThan(propertyPath:'date_fin', message:"Cette valeur doit être inférieure à date fin"),
Assert\NotBlank()]
private ?\DateTimeInterface $date_debut = null;
#[ORM\Column(type: Types::DATE_MUTABLE),
Assert\GreaterThan(propertyPath:'date_debut', message:"Cette valeur doit être supérieure à date début")
]
private ?\DateTimeInterface $date_fin = null;
#[ORM\Column(length: 255)]
private ?string $formateur = null;
#[ORM\Column(length: 255)]
private ?string $adresse = null;
#[ORM\Column(length: 255)]
private ?string $photo = null;
#[ORM\Column(length: 255)]
private ?string $documentProg = null;
#[UploadableField(mapping:'post_thumbnails', fileNameProperty:'photo')]
private $imageFile;
#[UploadableField(mapping:'post_thumbnails', fileNameProperty:'documentProg')]
private $DocFile;
#[ORM\Column(type: Types::TEXT, nullable:true)]
private ?string $description = null;
#[ORM\OneToMany(mappedBy: 'sessionFormation', targetEntity: InscriptionSessionFormation::class, cascade: ['persist', 'remove'])]
private Collection $inscriptionSessionFormations;
public function __construct()
{
$this->inscriptionSessionFormations = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getNumsession(): ?int
{
return $this->numsession;
}
public function setNumsession(int $numsession): self
{
$this->numsession = $numsession;
return $this;
}
public function getTitre(): ?string
{
return $this->titre;
}
public function setTitre(string $titre): self
{
$this->titre = $titre;
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 getFormateur(): ?string
{
return $this->formateur;
}
public function setFormateur(string $formateur): self
{
$this->formateur = $formateur;
return $this;
}
public function getAdresse(): ?string
{
return $this->adresse;
}
public function setAdresse(string $adresse): self
{
$this->adresse = $adresse;
return $this;
}
public function getPhoto(): ?string
{
return $this->photo;
}
public function setPhoto(string $photo): self
{
$this->photo = $photo;
return $this;
}
public function getDocumentProg(): ?string
{
return $this->documentProg;
}
public function setDocumentProg(string $documentProg): self
{
$this->documentProg = $documentProg;
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(string $description): self
{
$this->description = $description;
return $this;
}
public function setDocFile(File $image = null)
{
$this->DocFile = $image;
// VERY IMPORTANT:
// It is required that at least one field changes if you are using Doctrine,
// otherwise the event listeners won't be called and the file is lost
// if ($image) {
// if 'updatedAt' is not defined in your entity, use another property
// $this->updatedAt = new \DateTime('now');
// }
}
public function getDocFile()
{
return $this->DocFile;
}
public function setImageFile(File $image = null)
{
$this->imageFile = $image;
// VERY IMPORTANT:
// It is required that at least one field changes if you are using Doctrine,
// otherwise the event listeners won't be called and the file is lost
// if ($image) {
// if 'updatedAt' is not defined in your entity, use another property
// $this->updatedAt = new \DateTime('now');
// }
}
public function getImageFile()
{
return $this->imageFile;
}
/**
* @return Collection<int, InscriptionSessionFormation>
*/
public function getInscriptionSessionFormations(): Collection
{
return $this->inscriptionSessionFormations;
}
public function addInscriptionSessionFormation(InscriptionSessionFormation $inscriptionSessionFormation): self
{
if (!$this->inscriptionSessionFormations->contains($inscriptionSessionFormation)) {
$this->inscriptionSessionFormations->add($inscriptionSessionFormation);
$inscriptionSessionFormation->setSessionFormation($this);
}
return $this;
}
public function removeInscriptionSessionFormation(InscriptionSessionFormation $inscriptionSessionFormation): self
{
if ($this->inscriptionSessionFormations->removeElement($inscriptionSessionFormation)) {
// set the owning side to null (unless already changed)
if ($inscriptionSessionFormation->getSessionFormation() === $this) {
$inscriptionSessionFormation->setSessionFormation(null);
}
}
return $this;
}
}