src/Entity/Visa/VisaJustificatifs.php line 10

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Visa;
  3. use App\Repository\Visa\VisaJustificatifsRepository;
  4. use Doctrine\DBAL\Types\Types;
  5. use Doctrine\ORM\Mapping as ORM;
  6. #[ORM\Entity(repositoryClass: VisaJustificatifsRepository::class)]
  7. class VisaJustificatifs
  8. {
  9.     #[ORM\Id]
  10.     #[ORM\GeneratedValue]
  11.     #[ORM\Column(type: 'integer')]
  12.     private $id;
  13.     #[ORM\ManyToOne(targetEntity: VisaExigences::class, inversedBy: 'visaJustificatifs')]
  14.     #[ORM\JoinColumn(nullable: true)]
  15.     private VisaExigences $exigence;
  16.     #[ORM\Column(type: 'string', length: 255, nullable: true)]
  17.     private $nomDuFichier;
  18.     #[ORM\Column(type: 'string', length: 255, nullable: true)]
  19.     private $date;
  20.     #[ORM\Column(type: 'text', nullable: true)]
  21.     private $commentaireEntreprise;
  22.     #[ORM\Column(type: 'text', nullable: true)]
  23.     private $commentaireMOE;
  24.     #[ORM\ManyToOne(targetEntity: VisaProjets::class)]
  25.     private $projet;
  26.     public function getId(): ?int
  27.     {
  28.         return $this->id;
  29.     }
  30.     public function getExigence(): ?VisaExigences
  31.     {
  32.         return $this->exigence;
  33.     }
  34.     public function setExigence(?VisaExigences $exigence): self
  35.     {
  36.         $this->exigence = $exigence;
  37.         return $this;
  38.     }
  39.     public function getNomDuFichierTruncated(): ?string {
  40.            $nomDuFichier = $this->getNomDuFichier();
  41.            $infos = pathinfo($nomDuFichier);
  42.            $extention = $infos['extension'];
  43.            $file = $infos['filename'];
  44.            // Explode file with '-' and impolode with '-' without the last array value
  45.            $file = implode('-', array_slice(explode('-', $file), 0, -1));
  46.    
  47.    
  48.            if (strlen($file) > 20) {
  49.                $file = substr($nomDuFichier, 0, 20) . '[...]';
  50.            }
  51.            return $file.'.'.$extention;
  52.        }
  53.     public function getNomDuFichier(): ?string
  54.     {
  55.         return $this->nomDuFichier;
  56.     }
  57.     public function setNomDuFichier(?string $nomDuFichier): self
  58.     {
  59.         $this->nomDuFichier = $nomDuFichier;
  60.         return $this;
  61.     }
  62.     public function getDate(): ?string
  63.     {
  64.         return $this->date;
  65.     }
  66.     public function setDate(?string $date): self
  67.     {
  68.         $this->date = $date;
  69.         return $this;
  70.     }
  71.     public function getCommentaireEntreprise(): ?string
  72.     {
  73.         return $this->commentaireEntreprise;
  74.     }
  75.     public function setCommentaireEntreprise(?string $commentaireEntreprise): self
  76.     {
  77.         $this->commentaireEntreprise = $commentaireEntreprise;
  78.         return $this;
  79.     }
  80.     public function getCommentaireMOE(): ?string
  81.     {
  82.         return $this->commentaireMOE;
  83.     }
  84.     public function setCommentaireMOE(?string $commentaireMOE): self
  85.     {
  86.         $this->commentaireMOE = $commentaireMOE;
  87.         return $this;
  88.     }
  89.     public function getProjet(): ?VisaProjets
  90.     {
  91.         return $this->projet;
  92.     }
  93.     public function setProjet(?VisaProjets $projet): self
  94.     {
  95.         $this->projet = $projet;
  96.         return $this;
  97.     }
  98. }