Knp\Bundle\KnpBundlesBundle\Updater\Updater::searchNewBundles PHP Метод

searchNewBundles() публичный Метод

public searchNewBundles ( )
    public function searchNewBundles()
    {
        $this->output->writeln(sprintf('[%s] Trying to find bundle candidates', date('d-m-y H:i:s')));
        $bundles = array();
        foreach ($this->finder->find() as $fullName) {
            list($ownerName, $bundleName) = explode('/', $fullName);
            // We have it in DB already, skip it
            if ($this->bundleManager->findBundleBy(array('ownerName' => $ownerName, 'name' => $bundleName))) {
                continue;
            }
            $bundles[] = $fullName;
        }
        $this->output->writeln(sprintf('[%s] Found <comment>%d</comment> bundle candidates', date('d-m-y H:i:s'), count($bundles)));
        return $bundles;
    }

Usage Example

 /**
  * {@inheritdoc}
  *
  * @throws \InvalidArgumentException When the target directory does not exist
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $gitRepoDir = $this->getContainer()->getParameter('knp_bundles.bundles_dir');
     $gitBin = $this->getContainer()->getParameter('knp_bundles.git_bin');
     $em = $this->getContainer()->get('knp_bundles.entity_manager');
     $updater = new Updater($em, $gitRepoDir, $gitBin, $output);
     $updater->setUp();
     $bundles = $updater->searchNewBundles((int) $input->getOption('limit'));
     $updater->createMissingBundles($bundles);
     $em->flush();
 }