src/Entity/Produit/Service/Testimonial.php line 17

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Produit\Service;
  3. use App\Repository\Produit\Service\TestimonialRepository;
  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="`testimonial`")
  11.  * @ORM\Entity(repositoryClass=TestimonialRepository::class)
  12.  * @Vich\Uploadable
  13. */
  14. class Testimonial
  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="testimonial_file", 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="text", nullable=true)
  58.      */
  59.     private $description;
  60.     /**
  61.      * @ORM\Column(type="string", length=255)
  62.      */
  63.     private $autorName;
  64.     /**
  65.      * @ORM\Column(type="string", length=255, nullable=true)
  66.      */
  67.     private $autorPoste;
  68.     /**
  69.      * @ORM\Column(type="float", nullable=true)
  70.      */
  71.     private $note;
  72.     public function __construct()
  73.     {
  74.       $this->date = new \Datetime();
  75.     }
  76.     public function getId(): ?int
  77.     {
  78.         return $this->id;
  79.     }
  80.     public function getClientExtension()
  81.     {
  82.         $tabextension explode('.'$this->getOriginalName());
  83.         $nbelem count($tabextension);
  84.         if($nbelem 1)
  85.         {
  86.             return $tabextension[$nbelem 1];
  87.         }else{
  88.             return "";
  89.         }
  90.     }
  91.     public function getTimeOfSendingFiles(): string
  92.     {
  93.         if($this->date != null)
  94.         {
  95.             return $this->date->format('Y-m-d H:i:s');
  96.         }else{
  97.             return "0000-00-00 00:00:00";
  98.         }
  99.     }
  100.     public function getContentUrl(): ?string
  101.     {
  102.         return $this->contentUrl;
  103.     }
  104.     public function setContentUrl(?string $contentUrl): self
  105.     {
  106.         $this->contentUrl $contentUrl;
  107.         return $this;
  108.     }
  109.     public function getFilePath(): ?string
  110.     {
  111.         return $this->filePath;
  112.     }
  113.     public function setFilePath(?string $filePath): self
  114.     {
  115.         $this->filePath $filePath;
  116.         return $this;
  117.     }
  118.     public function getImageSize(): ?string
  119.     {
  120.         return $this->imageSize;
  121.     }
  122.     public function setImageSize(?string $imageSize): self
  123.     {
  124.         $this->imageSize $imageSize;
  125.         return $this;
  126.     }
  127.     public function getOriginalName(): ?string
  128.     {
  129.         return $this->originalName;
  130.     }
  131.     public function setOriginalName(?string $originalName): self
  132.     {
  133.         $this->originalName $originalName;
  134.         return $this;
  135.     }
  136.     public function getDate(): ?\DateTimeInterface
  137.     {
  138.         return $this->date;
  139.     }
  140.     public function setDate(\DateTimeInterface $date): self
  141.     {
  142.         $this->date $date;
  143.         return $this;
  144.     }
  145.     public function getMimeType(): ?string
  146.     {
  147.         return $this->mimeType;
  148.     }
  149.     public function setMimeType(string $mimeType null): self
  150.     {
  151.         $this->mimeType $mimeType;
  152.         return $this;
  153.     }
  154.     public function getUser(): ?User
  155.     {
  156.         return $this->user;
  157.     }
  158.     public function setUser(?User $user): self
  159.     {
  160.         $this->user $user;
  161.         return $this;
  162.     }
  163.     public function getDescription(): ?string
  164.     {
  165.         return $this->description;
  166.     }
  167.     public function setDescription(?string $description): self
  168.     {
  169.         $this->description $description;
  170.         return $this;
  171.     }
  172.     public function getAutorName(): ?string
  173.     {
  174.         return $this->autorName;
  175.     }
  176.     public function setAutorName(string $autorName): self
  177.     {
  178.         $this->autorName $autorName;
  179.         return $this;
  180.     }
  181.     public function getAutorPoste(): ?string
  182.     {
  183.         return $this->autorPoste;
  184.     }
  185.     public function setAutorPoste(?string $autorPoste): self
  186.     {
  187.         $this->autorPoste $autorPoste;
  188.         return $this;
  189.     }
  190.     public function getNote(): ?float
  191.     {
  192.         return $this->note;
  193.     }
  194.     public function setNote(?float $note): self
  195.     {
  196.         $this->note $note;
  197.         return $this;
  198.     }
  199. }