File.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <?php
  2. namespace Uploadable\Fixture\Entity;
  3. use Gedmo\Mapping\Annotation as Gedmo;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. /**
  7. * @ORM\Entity
  8. * @Gedmo\Uploadable(allowOverwrite=true, fileInfoProperty="fileInfo", pathMethod="getPath")
  9. */
  10. class File
  11. {
  12. /**
  13. * @ORM\Column(name="id", type="integer")
  14. * @ORM\Id
  15. * @ORM\GeneratedValue(strategy="IDENTITY")
  16. */
  17. private $id;
  18. /**
  19. * @ORM\Column(name="title", type="string", nullable=true)
  20. */
  21. private $title;
  22. /**
  23. * @ORM\Column(name="path", type="string", nullable=true)
  24. * @Gedmo\UploadableFilePath
  25. */
  26. private $filePath;
  27. private $fileInfo;
  28. /**
  29. * @ORM\ManyToOne(targetEntity="Article", inversedBy="files")
  30. * @ORM\JoinColumn(name="article_id", referencedColumnName="id")
  31. */
  32. private $article;
  33. public function getId()
  34. {
  35. return $this->id;
  36. }
  37. public function setTitle($title)
  38. {
  39. $this->title = $title;
  40. }
  41. public function getTitle()
  42. {
  43. return $this->title;
  44. }
  45. public function setFilePath($filePath)
  46. {
  47. $this->filePath = $filePath;
  48. }
  49. public function getFilePath()
  50. {
  51. return $this->filePath;
  52. }
  53. public function setArticle(Article $article)
  54. {
  55. $this->article = $article;
  56. }
  57. public function getArticle()
  58. {
  59. return $this->article;
  60. }
  61. public function setFileInfo(array $fileInfo)
  62. {
  63. $this->fileInfo = $fileInfo;
  64. }
  65. public function getFileInfo()
  66. {
  67. return $this->fileInfo;
  68. }
  69. public function getPath()
  70. {
  71. return __DIR__.'/../../../../temp/uploadable';
  72. }
  73. }