本文整理汇总了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();
}
示例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);
}
示例3: getFormValue
/**
* {@inheritdoc}
*/
public function getFormValue(array $converterAttributes, $value)
{
if ($value === null) {
return $this->businessUnitRepository->findAll();
}
return parent::getFormValue($converterAttributes, $value);
}
示例4: givenDatabaseIsClear
protected function givenDatabaseIsClear()
{
if (0 !== count($this->items->findAll())) {
$purger = new ORMPurger($this->entityManager);
$purger->purge();
}
}
示例5: getEmoteGenerator
/**
* @return \Generator
*/
private function getEmoteGenerator()
{
/** @var Emote[] $emotes */
$emotes = $this->entityRepository->findAll();
foreach ($emotes as $emote) {
(yield $emote);
}
}
示例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);
}
示例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);
}
}
示例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);
}
示例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;
}
示例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()));
}
}
示例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);
}
示例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();
}
示例13: findAll
public function findAll($published = false)
{
if (!$published) {
return parent::findAll();
} else {
return $this->getPublishedProjectsQuery();
}
}
示例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;
}
示例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]);
}