<?php
namespace App\Entity\Visa;
use App\Repository\Visa\VisaJustificatifsRepository;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: VisaJustificatifsRepository::class)]
class VisaJustificatifs
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private $id;
#[ORM\ManyToOne(targetEntity: VisaExigences::class, inversedBy: 'visaJustificatifs')]
#[ORM\JoinColumn(nullable: true)]
private VisaExigences $exigence;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private $nomDuFichier;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private $date;
#[ORM\Column(type: 'text', nullable: true)]
private $commentaireEntreprise;
#[ORM\Column(type: 'text', nullable: true)]
private $commentaireMOE;
#[ORM\ManyToOne(targetEntity: VisaProjets::class)]
private $projet;
public function getId(): ?int
{
return $this->id;
}
public function getExigence(): ?VisaExigences
{
return $this->exigence;
}
public function setExigence(?VisaExigences $exigence): self
{
$this->exigence = $exigence;
return $this;
}
public function getNomDuFichierTruncated(): ?string {
$nomDuFichier = $this->getNomDuFichier();
$infos = pathinfo($nomDuFichier);
$extention = $infos['extension'];
$file = $infos['filename'];
// Explode file with '-' and impolode with '-' without the last array value
$file = implode('-', array_slice(explode('-', $file), 0, -1));
if (strlen($file) > 20) {
$file = substr($nomDuFichier, 0, 20) . '[...]';
}
return $file.'.'.$extention;
}
public function getNomDuFichier(): ?string
{
return $this->nomDuFichier;
}
public function setNomDuFichier(?string $nomDuFichier): self
{
$this->nomDuFichier = $nomDuFichier;
return $this;
}
public function getDate(): ?string
{
return $this->date;
}
public function setDate(?string $date): self
{
$this->date = $date;
return $this;
}
public function getCommentaireEntreprise(): ?string
{
return $this->commentaireEntreprise;
}
public function setCommentaireEntreprise(?string $commentaireEntreprise): self
{
$this->commentaireEntreprise = $commentaireEntreprise;
return $this;
}
public function getCommentaireMOE(): ?string
{
return $this->commentaireMOE;
}
public function setCommentaireMOE(?string $commentaireMOE): self
{
$this->commentaireMOE = $commentaireMOE;
return $this;
}
public function getProjet(): ?VisaProjets
{
return $this->projet;
}
public function setProjet(?VisaProjets $projet): self
{
$this->projet = $projet;
return $this;
}
}