src/Entity/Projet/Partenaire/Partenaire.php line 17

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Projet\Partenaire;
  3. use App\Repository\Projet\Partenaire\PartenaireRepository;
  4. use Symfony\Component\HttpFoundation\File\File;
  5. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  6. use Symfony\Component\Validator\Constraints as Assert;
  7. use App\Entity\Users\User\User;
  8. use Doctrine\ORM\Mapping as ORM;
  9. /**
  10.  * @ORM\Table(name="`partenaire`")
  11.  * @ORM\Entity(repositoryClass=PartenaireRepository::class)
  12.  * @Vich\Uploadable
  13. */
  14. class Partenaire
  15. {
  16.     /**
  17.      * @ORM\Id
  18.      * @ORM\GeneratedValue
  19.      * @ORM\Column(type="integer")
  20.      */
  21.     private $id;
  22.     /**
  23.      * @ORM\Column(type="string", length=255, nullable=true)
  24.      */
  25.     public $contentUrl;
  26.     /**
  27.      * @ORM\Column(type="string", length=255, nullable=true)
  28.      */
  29.     private $filePath;
  30.     /**
  31.      * @Vich\UploadableField(mapping="partenaire", fileNameProperty="filePath", size="imageSize", mimeType="mimeType", originalName="originalName")
  32.      * @var File|null
  33.      */
  34.     public ?File $file null;
  35.     /**
  36.      * @ORM\Column(type="string", length=255, nullable=true)
  37.      */
  38.     private $imageSize;
  39.     /**
  40.      * @ORM\Column(type="string", length=255, nullable=true)
  41.      */
  42.     private $originalName;
  43.     /**
  44.      * @ORM\Column(type="datetime")
  45.      */
  46.     private $date;
  47.     /**
  48.      * @ORM\Column(type="string", length=255, nullable=true)
  49.      */
  50.     private $mimeType;
  51.     /**
  52.      * @ORM\ManyToOne(targetEntity=User::class)
  53.      * @ORM\JoinColumn(nullable=false)
  54.      */
  55.     private $user;
  56.     /**
  57.      * @ORM\Column(type="string", length=255)
  58.      */
  59.     private $name;
  60.     /**
  61.      * @ORM\Column(type="text", nullable=true)
  62.      */
  63.     private $description;
  64.     /**
  65.      * @ORM\Column(type="string", length=255, nullable=true)
  66.      */
  67.     private $link;
  68.     public function __construct()
  69.     {
  70.       $this->date = new \Datetime();
  71.     }
  72.     public function getId(): ?int
  73.     {
  74.         return $this->id;
  75.     }
  76.     public function getClientExtension()
  77.     {
  78.         $tabextension explode('.'$this->getOriginalName());
  79.         $nbelem count($tabextension);
  80.         if($nbelem 1)
  81.         {
  82.             return $tabextension[$nbelem 1];
  83.         }else{
  84.             return "";
  85.         }
  86.     }
  87.     public function getTimeOfSendingFiles(): string
  88.     {
  89.         if($this->date != null)
  90.         {
  91.             return $this->date->format('Y-m-d H:i:s');
  92.         }else{
  93.             return "0000-00-00 00:00:00";
  94.         }
  95.     }
  96.     public function getContentUrl(): ?string
  97.     {
  98.         return $this->contentUrl;
  99.     }
  100.     public function setContentUrl(?string $contentUrl): self
  101.     {
  102.         $this->contentUrl $contentUrl;
  103.         return $this;
  104.     }
  105.     public function getFilePath(): ?string
  106.     {
  107.         return $this->filePath;
  108.     }
  109.     public function setFilePath(?string $filePath): self
  110.     {
  111.         $this->filePath $filePath;
  112.         return $this;
  113.     }
  114.     public function getImageSize(): ?string
  115.     {
  116.         return $this->imageSize;
  117.     }
  118.     public function setImageSize(?string $imageSize): self
  119.     {
  120.         $this->imageSize $imageSize;
  121.         return $this;
  122.     }
  123.     public function getOriginalName(): ?string
  124.     {
  125.         return $this->originalName;
  126.     }
  127.     public function setOriginalName(?string $originalName): self
  128.     {
  129.         $this->originalName $originalName;
  130.         return $this;
  131.     }
  132.     public function getDate(): ?\DateTimeInterface
  133.     {
  134.         return $this->date;
  135.     }
  136.     public function setDate(\DateTimeInterface $date): self
  137.     {
  138.         $this->date $date;
  139.         return $this;
  140.     }
  141.     public function getMimeType(): ?string
  142.     {
  143.         return $this->mimeType;
  144.     }
  145.     public function setMimeType(string $mimeType null): self
  146.     {
  147.         $this->mimeType $mimeType;
  148.         return $this;
  149.     }
  150.     public function getUser(): ?User
  151.     {
  152.         return $this->user;
  153.     }
  154.     public function setUser(?User $user): self
  155.     {
  156.         $this->user $user;
  157.         return $this;
  158.     }
  159.     public function getName(): ?string
  160.     {
  161.         return $this->name;
  162.     }
  163.     public function setName(string $name): self
  164.     {
  165.         $this->name $name;
  166.         return $this;
  167.     }
  168.     public function getDescription(): ?string
  169.     {
  170.         return $this->description;
  171.     }
  172.     public function setDescription(?string $description): self
  173.     {
  174.         $this->description $description;
  175.         return $this;
  176.     }
  177.     public function getLink(): ?string
  178.     {
  179.         return $this->link;
  180.     }
  181.     public function setLink(?string $link): self
  182.     {
  183.         $this->link $link;
  184.         return $this;
  185.     }
  186. }