Doctrine ORM CLI Tool Not working

不羁的心 提交于 2019-12-12 19:32:21

问题


I had doctrine version 2.3.2 , whose CLI tool was working perfectly. Now, just trying to update to ORM v2.4.4, which is having the following error just by running "./vendor/bin/doctrine" command:

PHP Catchable fatal error:  Argument 1 passed to 
Doctrine\ORM\Tools\Console\ConsoleRunner::run() must be an instance of 
Symfony\Component\Console\Helper\HelperSet, integer given, called in 
/vagrant/vendor/doctrine/orm/bin/doctrine.php on line 59 and defined in 
/vagrant/vendor/doctrine/orm/lib/Doctrine/ORM/Tools/Console/ConsoleRunner.php on line 57

Can anybody please explain what might be wrong? Thanks.


回答1:


OK, I found the solution. This requires little change in cli-config as below:

$helperSet = new \Symfony\Component\Console\Helper\HelperSet(array(
    'db' => new \Doctrine\DBAL\Tools\Console\Helper\ConnectionHelper($em->getConnection()),
    'em' => new \Doctrine\ORM\Tools\Console\Helper\EntityManagerHelper($em)
));
return $helperSet;

In previous versions, only including the cli-config.php file would be OK(it expected a variable named '$helperSet' ). But, in new version, it requires to return the variable and get it assigned to its internal variable.



来源:https://stackoverflow.com/questions/25131662/doctrine-orm-cli-tool-not-working

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