123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102 |
- <?php
- namespace Uploadable\Fixture\Entity;
- use Gedmo\Mapping\Annotation as Gedmo;
- use Doctrine\ORM\Mapping as ORM;
- use Doctrine\Common\Collections\ArrayCollection;
- /**
- * @ORM\Entity
- * @Gedmo\Uploadable(allowOverwrite=true, pathMethod="getPath", callback="callbackMethod", maxSize="1")
- */
- class FileWithMaxSize
- {
- /**
- * @ORM\Column(name="id", type="integer")
- * @ORM\Id
- * @ORM\GeneratedValue(strategy="IDENTITY")
- */
- private $id;
- /**
- * @ORM\Column(name="title", type="string", nullable=true)
- */
- private $title;
- /**
- * @ORM\Column(name="path", type="string")
- * @Gedmo\UploadableFilePath
- */
- private $filePath;
- /**
- * @ORM\Column(name="size", type="decimal")
- * @Gedmo\UploadableFileSize
- */
- private $fileSize;
- /**
- * @ORM\ManyToOne(targetEntity="Article", inversedBy="files")
- * @ORM\JoinColumn(name="article_id", referencedColumnName="id")
- */
- private $article;
- public $callbackWasCalled = false;
- public function getId()
- {
- return $this->id;
- }
- public function setTitle($title)
- {
- $this->title = $title;
- }
- public function getTitle()
- {
- return $this->title;
- }
- public function setFilePath($filePath)
- {
- $this->filePath = $filePath;
- }
- public function getFilePath()
- {
- return $this->filePath;
- }
- public function setArticle(Article $article)
- {
- $this->article = $article;
- }
- public function getArticle()
- {
- return $this->article;
- }
- public function setFileSize($size)
- {
- $this->fileSize = $size;
- }
- public function getFileSize()
- {
- return $this->fileSize;
- }
- public function callbackMethod()
- {
- $this->callbackWasCalled = true;
- }
- public function getPath()
- {
- return __DIR__.'/../../../../temp/uploadable';
- }
- }
|