src/Entity/PieceJointe.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\PieceJointeRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Entity(repositoryClass=PieceJointeRepository::class)
  9.  */
  10. class PieceJointe
  11. {
  12.     const SAVE_PATH 'uploads/pieces_jointes/';
  13.     /**
  14.      * @ORM\Id
  15.      * @ORM\GeneratedValue
  16.      * @ORM\Column(type="integer")
  17.      */
  18.     private $id;
  19.     /**
  20.      * @ORM\Column(type="text", nullable=true)
  21.      */
  22.     private $filename;
  23.     /**
  24.      * @ORM\Column(type="string", length=128, nullable=true)
  25.      */
  26.     private $descriptionCourte;
  27.     /**
  28.      * @ORM\ManyToOne(targetEntity=Lot::class, inversedBy="pjs")
  29.      */
  30.     private $lot;
  31.     /**
  32.      * @ORM\ManyToOne(targetEntity=Programme::class, inversedBy="pjs")
  33.      */
  34.     private $programme;
  35.     /**
  36.      * @ORM\Column(type="integer")
  37.      */
  38.     private $ordre 0;
  39.     /**
  40.      * @ORM\Column(type="boolean")
  41.      */
  42.     private $showPublic false;
  43.     /**
  44.      * @ORM\Column(type="boolean")
  45.      */
  46.     private $estUnPlan false;
  47.     /**
  48.      * @ORM\Column(type="boolean", nullable=true)
  49.      */
  50.     private $estImageAdmin false;
  51.     /**
  52.      * @ORM\ManyToOne(targetEntity=PieceJointe::class, inversedBy="pieceJointeFille")
  53.      */
  54.     private $pieceJointeMere;
  55.     /**
  56.      * @ORM\OneToMany(targetEntity=PieceJointe::class, mappedBy="pieceJointeMere")
  57.      */
  58.     private $pieceJointeFille;
  59.     public function __construct()
  60.     {
  61.         $this->pieceJointeFille = new ArrayCollection();
  62.         $this->showPublic true;
  63.     }
  64.     public function __clone()
  65.     {
  66.         if ($this->id) {
  67.             $this->id null;
  68.          }
  69.     }
  70.     public function getId(): ?int
  71.     {
  72.         return $this->id;
  73.     }
  74.     public function getFilename(): ?string
  75.     {
  76.         return $this->filename;
  77.     }
  78.     public function getUnserializedFilename(): ?string
  79.     {
  80.         if (is_string($this->filename)) {
  81.             $unserialized = @unserialize($this->filename);
  82.             if ($unserialized !== false || $this->filename === 'b:0;') {
  83.                 $fullPath is_array($unserialized) && isset($unserialized[0]) ? $unserialized[0] : null;
  84.                 if ($fullPath) {
  85.                     return basename($fullPath);
  86.                 }
  87.             }
  88.         }
  89.         return $this->filename basename($this->filename) : null;
  90.     }
  91.     public function setFilename(?string $filename): self
  92.     {
  93.         $this->filename $filename;
  94.         return $this;
  95.     }
  96.     public function getFilenamePdf()
  97.     {
  98.         $data json_decode($this->getFilename(), true);
  99.         return $data;
  100.     }
  101.     public function getDescriptionCourte(): ?string
  102.     {
  103.         return $this->descriptionCourte;
  104.     }
  105.     public function setDescriptionCourte(?string $descriptionCourte): self
  106.     {
  107.         $this->descriptionCourte $descriptionCourte;
  108.         return $this;
  109.     }
  110.     public function getLot(): ?Lot
  111.     {
  112.         return $this->lot;
  113.     }
  114.     public function setLot(?Lot $lot): self
  115.     {
  116.         $this->lot $lot;
  117.         return $this;
  118.     }
  119.     public function getProgramme(): ?Programme
  120.     {
  121.         return $this->programme;
  122.     }
  123.     public function setProgramme(?Programme $programme): self
  124.     {
  125.         $this->programme $programme;
  126.         return $this;
  127.     }
  128.     public function getOrdre(): ?int
  129.     {
  130.         return $this->ordre;
  131.     }
  132.     public function setOrdre(int $ordre): self
  133.     {
  134.         $this->ordre $ordre;
  135.         return $this;
  136.     }
  137.     public function getEstUnPlan(): ?bool
  138.     {
  139.         return $this->estUnPlan;
  140.     }
  141.     public function setEstUnPlan(bool $estUnPlan): self
  142.     {
  143.         $this->estUnPlan $estUnPlan;
  144.         return $this;
  145.     }
  146.     public function getShowPublic(): ?bool
  147.     {
  148.         return $this->showPublic;
  149.     }
  150.     public function setShowPublic(bool $showPublic): self
  151.     {
  152.         $this->showPublic $showPublic;
  153.         return $this;
  154.     }
  155.     public function getEstImageAdmin(): ?bool
  156.     {
  157.         return $this->estImageAdmin;
  158.     }
  159.     public function setEstImageAdmin(?bool $estImageAdmin): self
  160.     {
  161.         $this->estImageAdmin $estImageAdmin;
  162.         return $this;
  163.     }
  164.     public function getPieceJointeMere(): ?self
  165.     {
  166.         return $this->pieceJointeMere;
  167.     }
  168.     public function setPieceJointeMere(?self $pieceJointeMere): self
  169.     {
  170.         $this->pieceJointeMere $pieceJointeMere;
  171.         return $this;
  172.     }
  173.     /**
  174.      * @return Collection<int, self>
  175.      */
  176.     public function getPieceJointeFille(): Collection
  177.     {
  178.         return $this->pieceJointeFille;
  179.     }
  180.     public function addPieceJointeFille(self $pieceJointeFille): self
  181.     {
  182.         if (!$this->pieceJointeFille->contains($pieceJointeFille)) {
  183.             $this->pieceJointeFille[] = $pieceJointeFille;
  184.             $pieceJointeFille->setPieceJointeMere($this);
  185.         }
  186.         return $this;
  187.     }
  188.     public function removePieceJointeFille(self $pieceJointeFille): self
  189.     {
  190.         if ($this->pieceJointeFille->removeElement($pieceJointeFille)) {
  191.             // set the owning side to null (unless already changed)
  192.             if ($pieceJointeFille->getPieceJointeMere() === $this) {
  193.                 $pieceJointeFille->setPieceJointeMere(null);
  194.             }
  195.         }
  196.         return $this;
  197.     }
  198. }