1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
| use Vich\UploaderBundle\Mapping\Annotation as Vich;
/**
* @ORM\Entity(repositoryClass="App\Repository\ArticleRepository")
* @ORM\HasLifecycleCallbacks
* @UniqueEntity(
* fields={"title"},
* message="Un autre article possède déjà le même titre"
* )
* @Vich\Uploadable
*/
class Article
{
/**
* @var string|null
* @ORM\Column(type="string", length=255,nullable=true)
*/
private $filename;
/**
* @var File|null
* @Vich\UploadableField(mapping="cover_image", fileNameProperty="filename")
* @Assert\File(mimeTypes={"application/png" ,"application/jpg","application/jpeg"})
*/
private $imageFile;
/**
* @return string|null
*/
public function getFilename(): ?string
{
return $this->filename;
}
/**
* @param string|null $filename
* @return Article
*/
public function setFilename(?string $filename): Article
{
$this->filename = $filename;
return $this;
}
/**
* @return File|null
*/
public function getImageFile(): ?File
{
return $this->imageFile;
}
/**
* @param File|null $imageFile
* @return Article
*/
public function setImageFile(?File $imageFile): Article
{
$this->imageFile = $imageFile;
return $this;
}
} |
Partager