简体   繁体   中英

Reference to a File sonata admin

I have two Documents, Question and Image : The Question references one Image.

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

When I add the Image field in the back-end using sonata admin bundle :

->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. UnitOfWork::getDocumentIdentifier() did not return an identifier for class ATS\\QuizzBundle\\Document\\Image Any one knows the origin of this error please ? 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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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