<?phpnamespace App\Entity;use Doctrine\ORM\Mapping as ORM;use App\Traits\CreatedUpdatedTrait;use JMS\Serializer\Annotation\Expose;use JMS\Serializer\Annotation\ExclusionPolicy;use Symfony\Component\HttpFoundation\File\File;use Vich\UploaderBundle\Mapping\Annotation as Vich;/** * Feedback * * @ORM\Table(name="v_feedback") * @ORM\Entity() * * @ExclusionPolicy("all") * @Vich\Uploadable */class Feedback{ /** * @ORM\Id() * @ORM\GeneratedValue() * @ORM\Column(type="integer") */ private $id; /** * @ORM\ManyToOne(targetEntity="App\Entity\User") */ private $user; /** * @var string * * @ORM\Column(name="message", type="text") * @Expose */ private $message; /** * NOTE: This is not a mapped field of entity metadata, just a simple property. * * @Vich\UploadableField(mapping="feedback_files", fileNameProperty="fileName") * * @var File */ private $feedbackFile; /** * @ORM\Column(name="file_name", type="string", length=255, nullable=true) * * @var string */ private $fileName; /** * @ORM\Column(name="current_progress", type="string", length=255, nullable=true) * * @var string */ private $currentProgress; use CreatedUpdatedTrait; public function __toString() { return (string) $this->message; } /** * Get id * * @return integer */ public function getId() { return $this->id; } /** * @return mixed */ public function getUser() { return $this->user; } /** * @param mixed $user */ public function setUser($user) { $this->user = $user; } /** * Set message * * @param string $message * @return Feedback */ public function setMessage($message) { $this->message = $message; return $this; } /** * Get message * * @return string */ public function getMessage() { return $this->message; } /** * If manually uploading a file (i.e. not using Symfony Form) ensure an instance * of 'UploadedFile' is injected into this setter to trigger the update. If this * bundle's configuration parameter 'inject_on_load' is set to 'true' this setter * must be able to accept an instance of 'File' as the bundle will inject one here * during Doctrine hydration. * * @param File|\Symfony\Component\HttpFoundation\File\UploadedFile $file */ public function setFeedbackFile(File $file = null) { $this->feedbackFile = $file; if ($file) { // It is required that at least one field changes if you are using doctrine // otherwise the event listeners won't be called and the file is lost $this->updated = new \DateTime('now'); } } /** * @return File */ public function getFeedbackFile() { return $this->feedbackFile; } /** * @param string $fileName */ public function setFileName($fileName) { $this->fileName = $fileName; } /** * @return string */ public function getFileName() { return $this->fileName; } /** * @return string */ public function getCurrentProgress() { return $this->currentProgress; } /** * @param string $currentProgress */ public function setCurrentProgress($currentProgress) { $this->currentProgress = $currentProgress; }}