protected function execute(InputInterface $input, OutputInterface $output)
 {
     $emName = $input->getOption('em');
     $emName = $emName ? $emName : 'default';
     $emServiceName = sprintf('doctrine.orm.%s_entity_manager', $emName);
     $em = $this->container->get($emServiceName);
     $dirOrFile = $input->getOption('fixtures');
     if ($dirOrFile) {
         $paths = is_array($dirOrFile) ? $dirOrFile : array($dirOrFile);
     } else {
         $paths = array();
         $bundleDirs = $this->container->getKernelService()->getBundleDirs();
         foreach ($this->container->getKernelService()->getBundles() as $bundle) {
             $tmp = dirname(str_replace('\\', '/', get_class($bundle)));
             $namespace = str_replace('/', '\\', dirname($tmp));
             $class = basename($tmp);
             if (isset($bundleDirs[$namespace]) && is_dir($dir = $bundleDirs[$namespace] . '/' . $class . '/DataFixtures/ORM')) {
                 $paths[] = $dir;
             }
         }
     }
     $loader = new \Doctrine\Common\DataFixtures\Loader();
     foreach ($paths as $path) {
         $loader->loadFromDirectory($path);
     }
     $fixtures = $loader->getFixtures();
     $purger = new \Doctrine\Common\DataFixtures\Purger\ORMPurger($em);
     $executor = new \Doctrine\Common\DataFixtures\Executor\ORMExecutor($em, $purger);
     $executor->setLogger(function ($message) use($output) {
         $output->writeln(sprintf('  <comment>></comment> <info>%s</info>', $message));
     });
     $executor->execute($fixtures, $input->getOption('append'));
 }
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $emName = $input->getOption('em');
     $emName = $emName ? $emName : 'default';
     $emServiceName = sprintf('doctrine.orm.%s_entity_manager', $emName);
     $em = $this->container->get($emServiceName);
     $dirOrFile = $input->getOption('fixtures');
     if ($dirOrFile) {
         $paths = is_array($dirOrFile) ? $dirOrFile : array($dirOrFile);
     } else {
         $paths = array();
         foreach ($this->application->getKernel()->getBundles() as $bundle) {
             $paths[] = $bundle->getPath() . '/DataFixtures/ORM';
         }
     }
     $loader = new \Doctrine\Common\DataFixtures\Loader();
     foreach ($paths as $path) {
         if (is_dir($path)) {
             $loader->loadFromDirectory($path);
         }
     }
     $fixtures = $loader->getFixtures();
     $purger = new \Doctrine\Common\DataFixtures\Purger\ORMPurger($em);
     $executor = new \Doctrine\Common\DataFixtures\Executor\ORMExecutor($em, $purger);
     $executor->setLogger(function ($message) use($output) {
         $output->writeln(sprintf('  <comment>></comment> <info>%s</info>', $message));
     });
     $executor->execute($fixtures, $input->getOption('append'));
 }