config.yml
vich_uploader:
db_driver: orm
mappings:
media_image:
uri_prefix: '%uploads_dir%'
upload_destination: '%kernel.root_dir%/../web/uploads/images'
namer: Vich\UploaderBundle\Naming\OrignameNamer
Entity:
/**
* Media
* @Vich\Uploadable
* @ORM\Table(name="medias")
* @ORM\Entity(repositoryClass="AppBundle\Repository\MediaRepository")
*/
class Media
{
use TimestampableEntity;
/**
* @var int
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @ORM\Column(type="string", length=255, nullable=true)
* @var string
*/
private $imageName;
/**
* @Vich\UploadableField(mapping="media_image", fileNameProperty="imageName", mimeType="mimeType", size="size")
* @var File
*/
private $imageFile;
/**
* @var string
*
* @ORM\Column(name="mime_type", type="string", length=20, nullable=true)
*/
private $mimeType;
/**
* @var string
*
* @ORM\Column(name="size", type="integer", nullable=true)
*/
private $size;
When I enable namer
, I am getting this error:
Any ideas why?
Vich\UploaderBundle\Naming\OrignameNamer
as a service? If yes - add the service definition to the question please. – Satirize