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

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Produit\Service;
  3. use App\Repository\Produit\Service\FaqRepository;
  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="`faq`")
  11.  * @ORM\Entity(repositoryClass=FaqRepository::class)
  12.  * @Vich\Uploadable
  13. */
  14. class Faq
  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="question_response", 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 $question;
  60.     /**
  61.      * @ORM\Column(type="text")
  62.      */
  63.     private $response;
  64.     public function __construct()
  65.     {
  66.       $this->date = new \Datetime();
  67.     }
  68.     public function getId(): ?int
  69.     {
  70.         return $this->id;
  71.     }
  72.     public function getClientExtension()
  73.     {
  74.         $tabextension explode('.'$this->getOriginalName());
  75.         $nbelem count($tabextension);
  76.         if($nbelem 1)
  77.         {
  78.             return $tabextension[$nbelem 1];
  79.         }else{
  80.             return "";
  81.         }
  82.     }
  83.     public function getTimeOfSendingFiles(): string
  84.     {
  85.         if($this->date != null)
  86.         {
  87.             return $this->date->format('Y-m-d H:i:s');
  88.         }else{
  89.             return "0000-00-00 00:00:00";
  90.         }
  91.     }
  92.     public function getContentUrl(): ?string
  93.     {
  94.         return $this->contentUrl;
  95.     }
  96.     public function setContentUrl(?string $contentUrl): self
  97.     {
  98.         $this->contentUrl $contentUrl;
  99.         return $this;
  100.     }
  101.     public function getFilePath(): ?string
  102.     {
  103.         return $this->filePath;
  104.     }
  105.     public function setFilePath(?string $filePath): self
  106.     {
  107.         $this->filePath $filePath;
  108.         return $this;
  109.     }
  110.     public function getImageSize(): ?string
  111.     {
  112.         return $this->imageSize;
  113.     }
  114.     public function setImageSize(?string $imageSize): self
  115.     {
  116.         $this->imageSize $imageSize;
  117.         return $this;
  118.     }
  119.     public function getOriginalName(): ?string
  120.     {
  121.         return $this->originalName;
  122.     }
  123.     public function setOriginalName(?string $originalName): self
  124.     {
  125.         $this->originalName $originalName;
  126.         return $this;
  127.     }
  128.     public function getDate(): ?\DateTimeInterface
  129.     {
  130.         return $this->date;
  131.     }
  132.     public function setDate(\DateTimeInterface $date): self
  133.     {
  134.         $this->date $date;
  135.         return $this;
  136.     }
  137.     public function getMimeType(): ?string
  138.     {
  139.         return $this->mimeType;
  140.     }
  141.     public function setMimeType(string $mimeType null): self
  142.     {
  143.         $this->mimeType $mimeType;
  144.         return $this;
  145.     }
  146.     public function getUser(): ?User
  147.     {
  148.         return $this->user;
  149.     }
  150.     public function setUser(?User $user): self
  151.     {
  152.         $this->user $user;
  153.         return $this;
  154.     }
  155.     public function getQuestion(): ?string
  156.     {
  157.         return $this->question;
  158.     }
  159.     public function setQuestion(string $question): self
  160.     {
  161.         $this->question $question;
  162.         return $this;
  163.     }
  164.     public function getResponse(): ?string
  165.     {
  166.         return $this->response;
  167.     }
  168.     public function setResponse(string $response): self
  169.     {
  170.         $this->response $response;
  171.         return $this;
  172.     }
  173. }