我正在使用VichUploader在symfony项目中上传文件.在我使用的配置中(从文档中复制):
service: vich_uploader.namer_property
options: { property: 'slug'}
Run Code Online (Sandbox Code Playgroud)
在我的实体中,我使用Gedmo/Sluggable自动生成slu ::
/**
* @Gedmo\Slug(fields={"title"}, updatable=false)
* @ORM\Column(type="string", length=100, nullable=false)
*/
protected $slug;
Run Code Online (Sandbox Code Playgroud)
但是当试图保存实体时,我得到以下错误500:
无法生成文件名:属性slug为空.
如果我将属性设置为'title'就可以了.我是否忘记了配置参数或其他什么来使它与Gedmo slug一起工作?
我有以下问题.我想这是误会.但谷歌搜索几个小时后没有找到解决方案我在这里发布.
我在Doctrine中有一个原生查询:
$rsm = new ResultSetMapping;
$rsm->addEntityResult('Acme\CommentBundle\Entity\Comment', 'c');
$rsm->addFieldResult('c', 'comment_id', 'id');
$rsm->addFieldResult('c', 'slug', 'slug');
$rsm->addFieldResult('c', 'comment', 'comment');
$rsm->addFieldResult('c', 'created', 'created');
$rsm->addJoinedEntityResult('Acme\AccountBundle\Entity\Worker', 'w', 'c', 'komments');
$rsm->addFieldResult('w', 'worker_id', 'id');
$rsm->addFieldResult('w', 'worker_name', 'name');
$rsm->addJoinedEntityResult('Acme\CommentBundle\Entity\Document', 'd', 'c', 'documents');
$rsm->addFieldResult('d', 'document_id', 'id');
$rsm->addFieldResult('d', 'document_name', 'name');
return $this->getEntityManager()
->createNativeQuery('SELECT t.id, c.id AS comment_id, c.slug, c.created, c.comment, c.worker_id AS comment_worker_id, c.created AS comment_created, d.id AS document_id, d.name AS document_name, w.id AS worker_id, w.name AS worker_name
FROM comment_thread t
INNER JOIN project p ON p.comment_thread_id = t.id
LEFT …Run Code Online (Sandbox Code Playgroud)