public function createMissingBundles(array $foundBundles)
{
$added = 0;
/* @var $bundle Bundle */
foreach ($foundBundles as $fullName) {
$bundle = $this->bundleManager->createBundle($fullName);
// It's not a valid Symfony2 Bundle or failed with our requirements (i.e: is a fork with less then 10 watchers)
if (!$bundle) {
$this->notifyInvalid($fullName, 'Bundle is not an valid Symfony2 Bundle or failed with our requirements, or we were not able to get such via API.');
continue;
}
$this->output->write(sprintf('[%s] Discover bundle <comment>%s</comment>: ', date('d-m-y H:i:s'), $bundle->getFullName()));
try {
$this->githubRepoApi->updateFiles($bundle);
} catch (\RuntimeException $e) {
$this->output->writeln(sprintf(' <error>%s</error>', $e->getMessage()));
continue;
}
$this->em->persist($bundle);
$this->updateRepo($bundle);
$this->output->writeln(' ADDED');
++$added;
}
$this->em->flush();
if ($added) {
$this->output->writeln(sprintf('[%s] Created <comment>%d</comment> new bundles', date('d-m-y H:i:s'), $added));
}
}