/**
  * {@inheritdoc}
  */
 public function populate(EntityManager $em = null)
 {
     $command = new PopulateCommand();
     $command->setContainer($this->kernel->getContainer());
     $output = new BufferedOutput();
     $input = new ArgvInput(['env' => $this->kernel->getEnvironment()]);
     if ($command->run($input, $output)) {
         //return code is not zero
         throw new \RuntimeException($output->fetch());
     }
     $this->output = $output->fetch();
     return $this;
 }
 /**
  * @see Symfony\Component\Console\Command\Command::execute()
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     if ($input->getOption('reset')) {
         $noReset = false;
     } else {
         $noReset = true;
     }
     $input->setOption('no-reset', $noReset);
     try {
         parent::execute($input, $output);
         $output->writeln($this->getNoLeftoversMessage());
     } catch (ExceededMemoryException $exception) {
         $output->writeln($exception->getMessage());
     }
 }