运行php app / console doctrine时出错:schema:在Symfony2中更新--force

时间:2014-03-13 08:52:20

标签: php symfony doctrine-orm doctrine

当我尝试运行命令php app/console doctrine:schema:update --force

我收到了一个错误:

PHP Catchable fatal error:  Argument 1 passed to
Doctrine\Bundle\DoctrineBundle\Command\Proxy\DoctrineCommandHelper::setApplicationEntityMan
ager() must be an instance of Symfony\Bundle\FrameworkBundle\Console\Application, instance 
of Application given, called in /var/www/xxx/vendor/doctrine/doctrine-
bundle/Doctrine/Bundle/DoctrineBundle/Command/Proxy/UpdateSchemaDoctrineCommand.php on line 
69 and defined in /var/www/xxx/vendor/doctrine/doctrine-
bundle/Doctrine/Bundle/DoctrineBundle/Command/Proxy/DoctrineCommandHelper.php on line 34

我找到的代码:

abstract class DoctrineCommandHelper
{
    /**
     * Convenience method to push the helper sets of a given entity manager into the application.
     *
     * @param Application $application
     * @param string      $emName
     */
    static public function setApplicationEntityManager(Application $application, $emName)
    {
        /** @var $em \Doctrine\ORM\EntityManager */
        $em = $application->getKernel()->getContainer()->get('doctrine')->getManager($emName);
        $helperSet = $application->getHelperSet();
        $helperSet->set(new ConnectionHelper($em->getConnection()), 'db');
        $helperSet->set(new EntityManagerHelper($em), 'em');
    }

第69行的UpdateSchemaDoctrineCommand.php

    protected function execute(InputInterface $input, OutputInterface $output)
{
    DoctrineCommandHelper::setApplicationEntityManager($this->getApplication(), $input->getOption('em'));

    parent::execute($input, $output);
}

我无法解决,有人知道解决方案吗?

作曲家的信息:

"symfony/symfony": "2.3.*",
"doctrine/orm": ">=2.2.3,<2.4-dev",
"doctrine/doctrine-bundle": "1.2.*",

0 个答案:

没有答案