Apigility - How to use Doctrine ORM Module from ZF2 command line

馋奶兔 提交于 2019-12-24 01:44:19

问题


Hi i'm new with Apigility. Im trying to configure doctrine-orm-module. When i tried to run the command below and getting this error

$ cd /var/www/apigility/zf-apigility-skeleton/vendor/doctrine/doctrine-module/bin
$ php doctrine-module.php

Error is:

PHP Fatal error:  Uncaught exception 'Zend\ServiceManager\Exception\ServiceNotFoundException' with message 'Zend\ServiceManager\ServiceManager::get was unable to fetch or create an instance for doctrine.cli' in /var/www/apigility/zf-apigility-skeleton/vendor/zendframework/zendframework/library/Zend/ServiceManager/ServiceManager.php:529
Stack trace:
#0 /var/www/apigility/zf-apigility-skeleton/vendor/doctrine/doctrine-module/bin/doctrine-module.php(51): Zend\ServiceManager\ServiceManager->get('doctrine.cli')
#1 {main} thrown in /var/www/apigility/zf-apigility-skeleton/vendor/zendframework/zendframework/library/Zend/ServiceManager/ServiceManager.php on line 529

Fatal error: Uncaught exception 'Zend\ServiceManager\Exception\ServiceNotFoundException' with message 'Zend\ServiceManager\ServiceManager::get was unable to fetch or create an instance for doctrine.cli' in /var/www/apigility/zf-apigility-skeleton/vendor/zendframework/zendframework/library/Zend/ServiceManager/ServiceManager.php:529
Stack trace:
#0 /var/www/apigility/zf-apigility-skeleton/vendor/doctrine/doctrine-module/bin/doctrine-module.php(51): Zend\ServiceManager\ServiceManager->get('doctrine.cli')
#1 {main} thrown in /var/www/apigility/zf-apigility-skeleton/vendor/zendframework/zendframework/library/Zend/ServiceManager/ServiceManager.php on line 529

I followed the installation guide on DoctrineORMModule's readme.md


回答1:


You don't need to run doctrine-module cli directly inside the bin folder. DoctrineModule already binds related console routes to the application if it's configured correctly.

Try this:

$ cd /var/www/apigility/zf-apigility-skeleton
$ php public/index.php orm:info

Hope it helps.



来源:https://stackoverflow.com/questions/26128660/apigility-how-to-use-doctrine-orm-module-from-zf2-command-line

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!