當前位置: 首頁>>代碼示例>>PHP>>正文


PHP EntityRepository::matching方法代碼示例

本文整理匯總了PHP中Doctrine\ORM\EntityRepository::matching方法的典型用法代碼示例。如果您正苦於以下問題:PHP EntityRepository::matching方法的具體用法?PHP EntityRepository::matching怎麽用?PHP EntityRepository::matching使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Doctrine\ORM\EntityRepository的用法示例。


在下文中一共展示了EntityRepository::matching方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: count

 public function count(array $criteria)
 {
     $criteriaObj = new Criteria();
     foreach ($criteria as $field => $value) {
         $criteriaObj->where($criteriaObj->expr()->eq($field, $value));
     }
     return $this->repository->matching($criteriaObj)->count();
 }
開發者ID:rmukras,項目名稱:ekda.org,代碼行數:8,代碼來源:Repository.php

示例2: matching

 /**
  * Select all elements from a selectable that match the expression and
  * return a new collection containing these elements.
  *
  * @param Criteria $criteria
  * @return \Doctrine\Common\Collections\Collection
  * @throws \LogicException
  */
 public function matching(Criteria $criteria)
 {
     if (!$this->baseRepository instanceof Selectable) {
         throw new \LogicException('The base repository does not implement Selectable.');
     }
     return $this->baseRepository->matching($criteria);
 }
開發者ID:mikegibson,項目名稱:sentient,代碼行數:15,代碼來源:ManagedRepository.php

示例3: getAllAsArray

 /**
  *
  * @return array
  */
 public function getAllAsArray(Organisation $organisation = null)
 {
     $list = array();
     if ($organisation) {
         $criteria = Criteria::create()->where(Criteria::expr()->eq('organisation', $organisation));
         $list = parent::matching($criteria);
     } else {
         $list = parent::findAll();
     }
     $res = array();
     foreach ($list as $element) {
         $res[$element->getId()] = $element->getName();
     }
     return $res;
 }
開發者ID:LeCoyote,項目名稱:epeires2,代碼行數:19,代碼來源:QualificationZoneRepository.php

示例4: getAllAsArray

 /**
  *
  * @return array
  */
 public function getAllAsArray($criteria = null)
 {
     $list = array();
     if ($criteria === null) {
         $list = parent::findAll();
     } else {
         if ($criteria instanceof Criteria) {
             $list = parent::matching($criteria);
         } else {
             $list = parent::findBy($criteria);
         }
     }
     $res = array();
     foreach ($list as $element) {
         $res[$element->getId()] = $element->getName();
     }
     return $res;
 }
開發者ID:LeCoyote,項目名稱:epeires2,代碼行數:22,代碼來源:ExtendedRepository.php

示例5: findTranslatableEntities

 protected function findTranslatableEntities(EntityRepository $repository, LocaleInterface $locale) : Collection
 {
     $criteria = new Criteria();
     $criteria->where($criteria->expr()->eq('locale', $locale->getCode()));
     $collection = $repository->matching($criteria);
     return $collection;
 }
開發者ID:wellcommerce,項目名稱:wellcommerce,代碼行數:7,代碼來源:LocaleCopier.php

示例6: totalNumberOfFilteredRecords

 /**
  * @param Criteria $criteria
  * @return int
  */
 public function totalNumberOfFilteredRecords(Criteria $criteria)
 {
     return parent::matching($criteria)->count();
 }
開發者ID:binaryfr3ak,項目名稱:sfitixi,代碼行數:8,代碼來源:CommonBaseRepositoryDoctrine.php

示例7: matching

 /** {@inheritdoc} @override */
 public function matching(Criteria $criteria)
 {
     if (null !== ($config = $this->getConfig()) && $config->get('multitenant.enabled')) {
         $criteria->andWhere($criteria->expr()->eq($config->get('multitenant.keymap'), $config->get('app.key')));
     }
     return parent::matching($criteria);
 }
開發者ID:ntd1712,項目名稱:common,代碼行數:8,代碼來源:AbstractDoctrineRepository.php

示例8: deleteTranslatableEntities

 /**
  * Deletes the translatable entities for locale
  *
  * @param EntityRepository $repository
  * @param LocaleInterface  $locale
  * @param OutputInterface  $output
  */
 protected function deleteTranslatableEntities(EntityRepository $repository, LocaleInterface $locale, OutputInterface $output)
 {
     $entityManager = $this->getDoctrineHelper()->getEntityManager();
     $criteria = new Criteria();
     $criteria->where($criteria->expr()->eq('locale', $locale->getCode()));
     $collection = $repository->matching($criteria);
     $collection->map(function (LocaleAwareInterface $entity) use($entityManager) {
         $entityManager->remove($entity);
     });
     $output->write(sprintf('Deleted <info>%s</info> entities <info>%s</info>', $collection->count(), $repository->getClassName()), true);
 }
開發者ID:WellCommerce,項目名稱:LocaleBundle,代碼行數:18,代碼來源:DeleteLocaleCommand.php


注:本文中的Doctrine\ORM\EntityRepository::matching方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。