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


PHP EntityRepository::findAll方法代碼示例

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


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

示例1: load

 /**
  * {@inheritdoc}
  */
 public function load(ObjectManager $manager)
 {
     $this->users = $this->user->findAll();
     $this->organization = $this->getReference('default_organization');
     $this->loadCalendars();
     $this->connectCalendars();
 }
開發者ID:antrampa,項目名稱:crm,代碼行數:10,代碼來源:LoadUsersCalendarData.php

示例2: indexAction

 /**
  * Get the attribute collection
  *
  * @return JsonResponse
  */
 public function indexAction()
 {
     $attributes = $this->attributeRepository->findAll();
     $filteredAttributes = $this->collectionFilter->filterCollection($attributes, 'pim.internal_api.attribute.view');
     $normalizedAttributes = $this->normalizer->normalize($filteredAttributes, 'internal_api');
     return new JsonResponse($normalizedAttributes);
 }
開發者ID:noglitchyo,項目名稱:pim-community-dev,代碼行數:12,代碼來源:AttributeController.php

示例3: getFormValue

 /**
  * {@inheritdoc}
  */
 public function getFormValue(array $converterAttributes, $value)
 {
     if ($value === null) {
         return $this->businessUnitRepository->findAll();
     }
     return parent::getFormValue($converterAttributes, $value);
 }
開發者ID:snorchel,項目名稱:platform,代碼行數:10,代碼來源:WidgetBusinessUnitSelectConverter.php

示例4: givenDatabaseIsClear

 protected function givenDatabaseIsClear()
 {
     if (0 !== count($this->items->findAll())) {
         $purger = new ORMPurger($this->entityManager);
         $purger->purge();
     }
 }
開發者ID:lzakrzewski,項目名稱:tests-with-database-examples,代碼行數:7,代碼來源:TestCase.php

示例5: getEmoteGenerator

 /**
  * @return \Generator
  */
 private function getEmoteGenerator()
 {
     /** @var Emote[] $emotes */
     $emotes = $this->entityRepository->findAll();
     foreach ($emotes as $emote) {
         (yield $emote);
     }
 }
開發者ID:jlwitthuhn,項目名稱:emotepack,代碼行數:11,代碼來源:ReleaseCompiler.php

示例6: indexAction

 /**
  * Get the family collection
  *
  * @return JsonResponse
  */
 public function indexAction()
 {
     $families = $this->familyRepository->findAll();
     $normalizedFamilies = [];
     foreach ($families as $family) {
         $normalizedFamilies[$family->getCode()] = $this->normalizer->normalize($family, 'json');
     }
     return new JsonResponse($normalizedFamilies);
 }
開發者ID:alexisfroger,項目名稱:pim-community-dev,代碼行數:14,代碼來源:FamilyController.php

示例7: readSettings

 /**
  * Reads all settings from database.
  *
  * @return void
  */
 private function readSettings()
 {
     /**
      * @var \Ableron\Modules\Core\Model\Entities\SettingEntity $settingEntity
      */
     foreach ($this->settingEntityRepository->findAll() as $settingEntity) {
         $this->settings->set($settingEntity->getName(), $settingEntity);
     }
 }
開發者ID:ableron,項目名稱:ableron-core,代碼行數:14,代碼來源:ApplicationConfiguration.php

示例8: indexAction

 /**
  * Get attribute group collection
  *
  * @return JsonResponse
  */
 public function indexAction()
 {
     $attributeGroups = $this->attributeGroupRepo->findAll();
     $filteredAttrGroups = $this->collectionFilter->filterCollection($attributeGroups, 'pim.internal_api.attribute_group.view');
     $normalizedAttrGroups = [];
     foreach ($filteredAttrGroups as $attributeGroup) {
         $normalizedAttrGroups[$attributeGroup->getCode()] = $this->normalizer->normalize($attributeGroup, 'json');
     }
     return new JsonResponse($normalizedAttrGroups);
 }
開發者ID:a2xchip,項目名稱:pim-community-dev,代碼行數:15,代碼來源:AttributeGroupController.php

示例9: getConfigOrEmpty

 /**
  * @return NotificationPluginConfiguration|null
  */
 public function getConfigOrEmpty()
 {
     $result = $this->notificationPluginConfigurationRepository->findAll();
     $config = null;
     if (count($result) > 0) {
         $config = $result[0];
     } else {
         $config = new NotificationPluginConfiguration();
     }
     return $config;
 }
開發者ID:claroline,項目名稱:distribution,代碼行數:14,代碼來源:NotificationPluginConfigurationManager.php

示例10: readEventHandlers

 /**
  * Reads event handlers from database.
  *
  * Event handlers can be stored in database, so they do not have to be
  * registered at the event manager manually during script execution.
  *
  * @return void
  */
 private function readEventHandlers()
 {
     /** @var \Ableron\Modules\Core\Model\Entities\EventHandlerEntity $eventHandlerEntity */
     foreach ($this->eventHandlerEntityRepository->findAll() as $eventHandlerEntity) {
         $this->registerEventHandler($eventHandlerEntity->getEventName(), ClassUtil::getInstance($eventHandlerEntity->getEventHandlerClass()));
     }
 }
開發者ID:ableron,項目名稱:ableron-core,代碼行數:15,代碼來源:EventManager.php

示例11:

 function it_handles_a_find_all_query(FindAll $query, EntityRepository $repository, EntityManagerInterface $em)
 {
     $query->getEntityClass()->willReturn('Indigo\\Crud\\Stub\\Entity');
     $repository->findAll()->shouldBeCalled();
     $em->getRepository('Indigo\\Crud\\Stub\\Entity')->willReturn($repository);
     $this->handle($query);
 }
開發者ID:indigophp,項目名稱:crud-doctrine,代碼行數:7,代碼來源:AllFinderSpec.php

示例12: initialize

 public function initialize(RequestConfiguration $requestConfiguration, MetadataInterface $metadataInterface, $resource, EntityRepository $repository)
 {
     if (!$requestConfiguration->isSortable()) {
         return;
     }
     $accessor = PropertyAccess::createPropertyAccessor();
     $property = $requestConfiguration->getSortablePosition();
     $strategy = $requestConfiguration->getSortingStrategy();
     if ($strategy == self::STRATEGY_DESC_LAST || $strategy == self::STRATEGY_ASC_FIRST) {
         // target value is 0, and we need to move all other elements one up
         $existingResources = $repository->findAll();
         if ($existingResources) {
             foreach ($existingResources as $existingResource) {
                 if ($resource === $existingResource) {
                     continue;
                 }
                 $value = $accessor->getValue($existingResource, $property);
                 $accessor->setValue($existingResource, $property, $value + 1);
             }
         }
         $newValue = 0;
     } else {
         // Initial value is maximum of other elements + 1
         $maxResource = $repository->createQueryBuilder('r')->orderBy('r.' . $property, 'desc')->setMaxResults(1)->getQuery()->getOneOrNullResult();
         if (!$maxResource) {
             $newValue = 0;
         } else {
             $maxValue = $accessor->getValue($maxResource, $property);
             $newValue = $maxValue + 1;
         }
     }
     $accessor->setValue($resource, $property, $newValue);
     $this->em->flush();
 }
開發者ID:enhavo,項目名稱:enhavo,代碼行數:34,代碼來源:SortingManager.php

示例13: findAll

 public function findAll($published = false)
 {
     if (!$published) {
         return parent::findAll();
     } else {
         return $this->getPublishedProjectsQuery();
     }
 }
開發者ID:BelkaB,項目名稱:tangara-server,代碼行數:8,代碼來源:ProjectRepository.php

示例14: getItems

 public function getItems()
 {
     $accessor = PropertyAccess::createPropertyAccessor();
     $objects = $this->repository->findAll();
     $items = [];
     foreach ($objects as $object) {
         $item = new Item();
         $item->setValue($object);
         $properties = array();
         foreach ($this->itemProperties as $itemProperty => $itemPropertyLabel) {
             $properties[$itemProperty] = $accessor->getValue($object, $itemProperty);
         }
         $item->setProperties($properties);
         $items[] = $item;
     }
     return $items;
 }
開發者ID:mia3,項目名稱:expose,代碼行數:17,代碼來源:DoctrineEntityIndex.php

示例15: ArticleCategory

 function it_returns_article_category_list(EntityRepository $repository)
 {
     $firstArticleCategory = new ArticleCategory();
     $firstArticleCategory->setSlug('chrono-trigger');
     $secondArticleCategory = new ArticleCategory();
     $secondArticleCategory->setSlug('chrono-cross');
     $repository->findAll()->willReturn([$firstArticleCategory, $secondArticleCategory]);
     $this->getAll()->shouldReturn([$firstArticleCategory, $secondArticleCategory]);
 }
開發者ID:lukasz-jakub-adamczuk,項目名稱:sapi,代碼行數:9,代碼來源:ArticleCategoryProviderSpec.php


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