protected function execute(InputInterface $input, OutputInterface $output)
{
$indexer = $this->getContainer()->get('knp_bundles.indexer.solr');
$indexer->deleteBundlesIndexes();
$doctrine = $this->getContainer()->get('doctrine');
$bundles = $doctrine->getRepository('KnpBundlesBundle:Bundle')->findAll();
$count = count($bundles);
foreach ($bundles as $key => $bundle) {
try {
$indexer->indexBundle($bundle);
$this->printOutput($output, $key, $count);
} catch (Exception $e) {
$output->writeln(sprintf("<error>Exception: %s, skipping bundle %s.</error>", $e->getMessage(), $bundle->getFullName()));
}
unset($bundles[$key]);
}
}