Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/arduino/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Symfony2以编程方式调用控制台命令不适用于名称空间_Symfony_Console_Doctrine_Command - Fatal编程技术网

Symfony2以编程方式调用控制台命令不适用于名称空间

Symfony2以编程方式调用控制台命令不适用于名称空间,symfony,console,doctrine,command,Symfony,Console,Doctrine,Command,我在Symfony2中执行命令时遇到问题,主要是我有一个命令“php app/console lets:do:this” 正在执行现有命令的: $this->dumpToXml($input, $output); $this->dumpToAnnotation($input, $output); $this->dumpToEntity($input, $output); 但是第二个命令“dumpToAnnotation”失败。它确实生成php实体文件,

我在Symfony2中执行命令时遇到问题,主要是我有一个命令“php app/console lets:do:this”

正在执行现有命令的:

    $this->dumpToXml($input, $output);
    $this->dumpToAnnotation($input, $output);
    $this->dumpToEntity($input, $output);
但是第二个命令“dumpToAnnotation”失败。它确实生成php实体文件,但没有名称空间(名称空间包含在orm.xml文件中)

这就是失败的方法:

private function dumpToAnnotation(InputInterface $input, OutputInterface $output)
{
    // check if the command exists
    $command = $this->getApplication()->find('doctrine:mapping:convert');

    // collect all arguments and options
    $arguments = array(
        'command'      => 'doctrine:mapping:convert',
        'to-type'      => 'annotation',
        'dest-path'    => './src',
        '--force'      => true
    );

    // core objects
    $input = new ArrayInput($arguments);

    // execute the command
    $command->run($input, $output);
}
它给出了处理实体“用户”的输出,而不是处理实体“MyApp/MyBundle/entity/Users”

当我从CLI执行命令时,根本没有问题,只是在Symfony2命令中不起作用

我希望有人能帮我


你好,格雷格。

你有没有想过?有同样的问题其实不是,我放弃了这个想法,用命令行提出了不同的解决方案。