i have followed How to integrate ZF2 with Doctrine Mongo ODM? to setup ZF2 With Doctrine Mongo ODM,
I can save document into mongodb,however i can not find the document using below code
$dm = $this->getLocator()->get('mongo_dm');
$result = $dm->find('Item', '4f9ea557eabc88e96f000000');
print_r($result);
Here is the error log
PHP Warning: class_parents(): Class Item does not exist and could not be loaded in /var/www/vendor/DoctrineMongoODMModule/vendor/mongodb-odm/lib/Doctrine/ODM/MongoDB/Mapping/ClassMetadataFactory.php on line 347
PHP Warning: array_reverse() expects parameter 1 to be array, boolean given in /var/www/vendor/DoctrineMongoODMModule/vendor/mongodb-odm/lib/Doctrine/ODM/MongoDB/Mapping/ClassMetadataFactory.php on line 347
PHP Warning: Invalid argument supplied for foreach() in /var/www/vendor/DoctrineMongoODMModule/vendor/mongodb-odm/lib/Doctrine/ODM/MongoDB/Mapping/ClassMetadataFactory.php on line 347
i already try generate document using
./vendor/DoctrineModule/bin/doctrine odm:generate:documents ./module/Application/src/Application/
$dm = $this->getLocator()->get('mongo_dm');
$result = $dm->find('Application\Document\Item', '4f9ea557eabc88e96f000000');
should fix those problem
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.