FileWithAlphanumericName.php 936 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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(pathMethod="getPath", filenameGenerator="ALPHANUMERIC", appendNumber=true)
  9. */
  10. class FileWithAlphanumericName
  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="path", type="string", nullable=true)
  20. * @Gedmo\UploadableFilePath
  21. */
  22. private $filePath;
  23. public function getId()
  24. {
  25. return $this->id;
  26. }
  27. public function setFilePath($filePath)
  28. {
  29. $this->filePath = $filePath;
  30. }
  31. public function getFilePath()
  32. {
  33. return $this->filePath;
  34. }
  35. public function getPath()
  36. {
  37. return __DIR__.'/../../../../temp/uploadable';
  38. }
  39. }