Knp\Bundle\KnpBundlesBundle\Manager\BundleManager::findBundleBy PHP Method

findBundleBy() public method

public findBundleBy ( array $data ) : null | Bundle
$data array
return null | Knp\Bundle\KnpBundlesBundle\Entity\Bundle
    public function findBundleBy(array $data)
    {
        return $this->entityManager->getRepository('Knp\\Bundle\\KnpBundlesBundle\\Entity\\Bundle')->findOneBy($data);
    }

Usage Example

Beispiel #1
0
 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;
 }