validate() public méthode

public validate ( Bundle $bundle ) : boolean
$bundle Knp\Bundle\KnpBundlesBundle\Entity\Bundle
Résultat boolean
Exemple #1
0
 /**
  * @param string $name
  * @param string $ownerName
  *
  * @return boolean|Bundle return false if the bundle is not valid
  */
 private function createFullBundle($name, $ownerName)
 {
     $bundle = $this->createEmptyBundle($name);
     $bundle->setOwnerName($ownerName);
     if (!$this->repoApi->validate($bundle)) {
         return false;
     }
     if (!$this->repoApi->updateInfos($bundle)) {
         return false;
     }
     $owner = $this->ownerManager->createOwner($ownerName, 'unknown', false);
     if (!$owner) {
         return false;
     }
     $owner->addBundle($bundle);
     return $bundle;
 }
Exemple #2
0
 public function removeNonSymfonyBundles()
 {
     $counter = 0;
     $page = 1;
     $pager = $this->paginateExistingBundles($page);
     $this->output->writeln(sprintf('[%s] Will now check <comment>%d</comment> bundles', date('d-m-y H:i:s'), $pager->getNbResults()));
     do {
         /** @var $bundle Bundle */
         foreach ($pager->getCurrentPageResults() as $bundle) {
             if (!$this->githubRepoApi->validate($bundle)) {
                 $this->notifyInvalid($bundle->getFullName(), sprintf('File "%sBundle.php" with base class was not found.', ucfirst($bundle->getFullName())));
                 if (!$this->removeRepo($bundle)) {
                     $bundle->getOwner()->removeBundle($bundle);
                     $this->em->remove($bundle);
                 }
                 ++$counter;
             }
         }
         ++$page;
     } while ($pager->hasNextPage() && $pager->setCurrentPage($page, false, true));
     $this->output->writeln(sprintf('[%s] <comment>%s</comment> invalid bundles have been found and removed', date('d-m-y H:i:s'), $counter));
     $this->em->flush();
 }