FileAppendNumber.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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(appendNumber=true, pathMethod="getPath")
  9. */
  10. class FileAppendNumber
  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")
  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. public function getPath()
  61. {
  62. return __DIR__.'/../../../../temp/uploadable';
  63. }
  64. }