src/Entity/Feedback.php line 21

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use App\Traits\CreatedUpdatedTrait;
  5. use JMS\Serializer\Annotation\Expose;
  6. use JMS\Serializer\Annotation\ExclusionPolicy;
  7. use Symfony\Component\HttpFoundation\File\File;
  8. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  9. /**
  10.  * Feedback
  11.  *
  12.  * @ORM\Table(name="v_feedback")
  13.  * @ORM\Entity()
  14.  *
  15.  * @ExclusionPolicy("all")
  16.  * @Vich\Uploadable
  17.  */
  18. class Feedback
  19. {
  20.     /**
  21.      * @ORM\Id()
  22.      * @ORM\GeneratedValue()
  23.      * @ORM\Column(type="integer")
  24.      */
  25.     private $id;
  26.     /**
  27.      * @ORM\ManyToOne(targetEntity="App\Entity\User")
  28.      */
  29.     private $user;
  30.     /**
  31.      * @var string
  32.      *
  33.      * @ORM\Column(name="message", type="text")
  34.      * @Expose
  35.      */
  36.     private $message;
  37.     /**
  38.      * NOTE: This is not a mapped field of entity metadata, just a simple property.
  39.      *
  40.      * @Vich\UploadableField(mapping="feedback_files", fileNameProperty="fileName")
  41.      *
  42.      * @var File
  43.      */
  44.     private $feedbackFile;
  45.     /**
  46.      * @ORM\Column(name="file_name", type="string", length=255, nullable=true)
  47.      *
  48.      * @var string
  49.      */
  50.     private $fileName;
  51.     /**
  52.      * @ORM\Column(name="current_progress", type="string", length=255, nullable=true)
  53.      *
  54.      * @var string
  55.      */
  56.     private $currentProgress;
  57.     use CreatedUpdatedTrait;
  58.     public function __toString()
  59.     {
  60.         return (string) $this->message;
  61.     }
  62.     /**
  63.      * Get id
  64.      *
  65.      * @return integer 
  66.      */
  67.     public function getId()
  68.     {
  69.         return $this->id;
  70.     }
  71.     /**
  72.      * @return mixed
  73.      */
  74.     public function getUser()
  75.     {
  76.         return $this->user;
  77.     }
  78.     /**
  79.      * @param mixed $user
  80.      */
  81.     public function setUser($user)
  82.     {
  83.         $this->user $user;
  84.     }
  85.     /**
  86.      * Set message
  87.      *
  88.      * @param string $message
  89.      * @return Feedback
  90.      */
  91.     public function setMessage($message)
  92.     {
  93.         $this->message $message;
  94.         return $this;
  95.     }
  96.     /**
  97.      * Get message
  98.      *
  99.      * @return string 
  100.      */
  101.     public function getMessage()
  102.     {
  103.         return $this->message;
  104.     }
  105.     /**
  106.      * If manually uploading a file (i.e. not using Symfony Form) ensure an instance
  107.      * of 'UploadedFile' is injected into this setter to trigger the  update. If this
  108.      * bundle's configuration parameter 'inject_on_load' is set to 'true' this setter
  109.      * must be able to accept an instance of 'File' as the bundle will inject one here
  110.      * during Doctrine hydration.
  111.      *
  112.      * @param File|\Symfony\Component\HttpFoundation\File\UploadedFile $file
  113.      */
  114.     public function setFeedbackFile(File $file null)
  115.     {
  116.         $this->feedbackFile $file;
  117.         if ($file) {
  118.             // It is required that at least one field changes if you are using doctrine
  119.             // otherwise the event listeners won't be called and the file is lost
  120.             $this->updated = new \DateTime('now');
  121.         }
  122.     }
  123.     /**
  124.      * @return File
  125.      */
  126.     public function getFeedbackFile()
  127.     {
  128.         return $this->feedbackFile;
  129.     }
  130.     /**
  131.      * @param string $fileName
  132.      */
  133.     public function setFileName($fileName)
  134.     {
  135.         $this->fileName $fileName;
  136.     }
  137.     /**
  138.      * @return string
  139.      */
  140.     public function getFileName()
  141.     {
  142.         return $this->fileName;
  143.     }
  144.     /**
  145.      * @return string
  146.      */
  147.     public function getCurrentProgress()
  148.     {
  149.         return $this->currentProgress;
  150.     }
  151.     /**
  152.      * @param string $currentProgress
  153.      */
  154.     public function setCurrentProgress($currentProgress)
  155.     {
  156.         $this->currentProgress $currentProgress;
  157.     }
  158. }