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 如何让企业微信机器人实现消息汇总整合
  • ¥50 关于#ui#的问题:做yolov8的ui界面出现的问题
  • ¥15 如何用Python爬取各高校教师公开的教育和工作经历
  • ¥15 TLE9879QXA40 电机驱动
  • ¥20 对于工程问题的非线性数学模型进行线性化
  • ¥15 Mirare PLUS 进行密钥认证?(详解)
  • ¥15 物体双站RCS和其组成阵列后的双站RCS关系验证
  • ¥20 想用ollama做一个自己的AI数据库
  • ¥15 关于qualoth编辑及缝合服装领子的问题解决方案探寻
  • ¥15 请问怎么才能复现这样的图呀