在Doctrine Fixtures Load中访问命令OutputInterface

con*_*con 4 php command symfony doctrine-orm

我正在使用令人敬畏的Faker库生成大量的数据夹具,也使用lorempixel.com在我的Symfony2项目中有一些随机图像.这需要一些时间(目前约10分钟),所以我想知道是否可以通过容器界面以某种方式访问Command OutputInterface并以这种方式打印进度而不是echo'ing所有内容.

也许还有一个很好的输出与ProgressBar

Joh*_*ast 7

看起来ConsoleOutput不需要任何特殊的东西,可以直接实例化.

use Symfony\Component\Console\Output\ConsoleOutput;

// ...

public function load(ObjectManager $manager)
{
    $output = new ConsoleOutput();

    $output->writeln('<inf>this works... </info>');
} 
Run Code Online (Sandbox Code Playgroud)