当前位置: 首页>>代码示例>>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;未经允许,请勿转载。