简体   繁体   English

引用文件奏鸣曲管理员

[英]Reference to a File sonata admin

I have two Documents, Question and Image : The Question references one Image. 我有两个文档Question和Image:Question引用一个Image。

 /**
 *@MongoDB\ReferenceOne(targetDocument="Image") 
 */
protected $image ;

When I add the Image field in the back-end using sonata admin bundle : 当我使用sonata admin bundle在后端添加Image字段时:

->add('image', 'sonata_type_admin', array('by_reference' => false))

The uploading Button appears but when I try to persist the question I got this exception : 出现上传按钮,但是当我尝试坚持这个问题时,出现了这个异常:

Cannot create a DBRef without an identifier. 没有标识符,无法创建DBRef。 UnitOfWork::getDocumentIdentifier() did not return an identifier for class ATS\\QuizzBundle\\Document\\Image Any one knows the origin of this error please ? UnitOfWork :: getDocumentIdentifier()没有返回类ATS \\ QuizzBu​​ndle \\ Document \\ Image的标识符有人知道此错误的源吗? thank you 谢谢

I think it is the same problem which has been patched i think, but you should look at it, if it is already pushed then update mongodb if it helps. 我认为这是我认为已修复的同一问题,但是您应该查看一下,如果它已被推送,请在有帮助的情况下更新mongodb。

https://github.com/doctrine/mongodb-odm/issues/1017 https://github.com/doctrine/mongodb-odm/issues/1017

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM