douxiong5438 2014-01-27 08:58
浏览 207
已采纳

在symfony中执行自定义控制台命令时出现致命错误

I'm trying to create a custom console command for my project so i thought I'll first try it out with the example given in the symfony site, I have provided the steps it took to reach this far,

Step 1: Added  "symfony/console": "2.3.*@dev", to composer.json.
Step 2: Updated composer.

The code written for the command is given below

class Sendgcmfuctions extends ContainerAwareCommand {
protected function configure()
{
    $this
        ->setName('demo:greet')
        ->setDescription('Greet someone')
        ->addArgument('name', InputArgument::OPTIONAL, 'Who do you want to greet?')
        ->addOption('yell', null, InputOption::VALUE_NONE, 'If set, the task will yell in uppercase letters')
    ;
}

protected function execute(InputInterface $input, OutputInterface $output)
{
    $name = $input->getArgument('name');
    if ($name) {
        $text = 'Hello '.$name;
    } else {
        $text = 'Hello';
    }

    if ($input->getOption('yell')) {
        $text = strtoupper($text);
    }

    $output->writeln($text);
}
}

On running "php app/console demo:greet" the following error is produced

PHP Fatal error:  Class 'Doctrine\ORM\Tools\Console\Command\ClearCache\QueryRegionCommand' not found in /var/www/MobpazAdmin/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Command/Proxy/QueryRegionCacheDoctrineCommand.php on line 29

The "Sendgcmfuctions" is inside a Command folder inside my bundle. Please tell me the mistake commited while doing this

  • 写回答

3条回答 默认 最新

  • dtsc1684 2014-01-27 10:57
    关注

    it seems to be an issue of doctrine's latest bundle. try use another stable version.

    "doctrine/doctrine-bundle": "1.2.0" works for us

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 求差集那个函数有问题,有无佬可以解决
  • ¥15 【提问】基于Invest的水源涵养
  • ¥20 微信网友居然可以通过vx号找到我绑的手机号
  • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
  • ¥15 解riccati方程组
  • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
  • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名
  • ¥65 汇编语言除法溢出问题