File.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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()
  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. /**
  28. * @ORM\ManyToOne(targetEntity="Article", inversedBy="files")
  29. * @ORM\JoinColumn(name="article_id", referencedColumnName="id")
  30. */
  31. private $article;
  32. public function getId()
  33. {
  34. return $this->id;
  35. }
  36. public function setTitle($title)
  37. {
  38. $this->title = $title;
  39. }
  40. public function getTitle()
  41. {
  42. return $this->title;
  43. }
  44. public function setFilePath($filePath)
  45. {
  46. $this->filePath = $filePath;
  47. }
  48. public function getFilePath()
  49. {
  50. return $this->filePath;
  51. }
  52. public function setArticle(Article $article)
  53. {
  54. $this->article = $article;
  55. }
  56. public function getArticle()
  57. {
  58. return $this->article;
  59. }
  60. /**
  61. * @Gedmo\UploadablePath
  62. */
  63. public function getPath()
  64. {
  65. return __DIR__.'/../../../../temp/uploadable';
  66. }
  67. /**
  68. * @Gedmo\UploadableFilesArrayIndex
  69. */
  70. public function getFilesArrayIndex()
  71. {
  72. return '[file]';
  73. }
  74. }