当前位置: 首页>>代码示例>>PHP>>正文


PHP ObjectRepository::findAll方法代码示例

本文整理汇总了PHP中Doctrine\Common\Persistence\ObjectRepository::findAll方法的典型用法代码示例。如果您正苦于以下问题:PHP ObjectRepository::findAll方法的具体用法?PHP ObjectRepository::findAll怎么用?PHP ObjectRepository::findAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Doctrine\Common\Persistence\ObjectRepository的用法示例。


在下文中一共展示了ObjectRepository::findAll方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: get

 /**
  * @{inheritdoc}
  */
 public function get($id = null)
 {
     if (null !== $id) {
         return $this->repository->find($id);
     }
     return $this->repository->findAll();
 }
开发者ID:KmeCnin,项目名称:fumble-mania-rest-backend,代码行数:10,代码来源:AbstractManager.php

示例2: loadChoiceList

 /**
  * {@inheritdoc}
  */
 public function loadChoiceList($value = null)
 {
     if ($this->choiceList) {
         return $this->choiceList;
     }
     return $this->choiceList = $this->factory->createListFromChoices($this->repository->findAll(), $value);
 }
开发者ID:integratedfordevelopers,项目名称:integrated-channel-bundle,代码行数:10,代码来源:ChannelChoiceLoader.php

示例3: getRoles

 /**
  * {@inheritDoc}
  */
 public function getRoles()
 {
     $result = $this->objectRepository->findAll();
     $roles = array();
     // Pass One: Build each object
     foreach ($result as $role) {
         if (!$role instanceof RoleInterface) {
             continue;
         }
         $roleId = $role->getRoleId();
         $parent = null;
         if ($role instanceof HierarchicalRoleInterface && ($parent = $role->getParent())) {
             $parent = $parent->getRoleId();
         }
         $roles[$roleId] = new Role($roleId, $parent);
     }
     // Pass Two: Re-inject parent objects to preserve hierarchy
     /* @var $roleObj \BjyAuthorize\Acl\Role */
     foreach ($roles as $roleObj) {
         $parentRoleObj = $roleObj->getParent();
         if ($parentRoleObj && $parentRoleObj->getRoleId()) {
             $roleObj->setParent($roles[$parentRoleObj->getRoleId()]);
         }
     }
     return array_values($roles);
 }
开发者ID:pbrilius,项目名称:BjyAuthorize,代码行数:29,代码来源:ObjectRepositoryProvider.php

示例4: getRules

 /**
  * Here we read rules from DB and put them into a form that BjyAuthorize's Controller.php understands
  */
 public function getRules()
 {
     $rules = array();
     // initialize the rules array
     //
     // get the doctrine shemaManager
     $schemaManager = $this->objectManager->getConnection()->getSchemaManager();
     // check if the roles table exists, if it does not, do not bother querying
     if ($schemaManager->tablesExist(array('roles')) === true) {
         //read from object store a set of (role, controller, action)
         $result = $this->objectRepository->findAll();
         // if a result set exists
         if (count($result)) {
             //transform to object BjyAuthorize will understand
             foreach ($result as $key => $role) {
                 $roleId = $role->getRoleId();
                 // check if any resource access has been defined before
                 // if it has, continue with normal operations
                 // else, allow access to this first user
                 if (!$role->getResources()) {
                     continue;
                 }
                 foreach ($role->getResources() as $rle) {
                     $this->defaultRules['allow'][] = [[$roleId], $rle->getControllerId(), []];
                 }
             }
         }
     }
     return $this->defaultRules;
 }
开发者ID:AwoyoToyin,项目名称:ZfMuscle,代码行数:33,代码来源:DoctrineRuleProvider.php

示例5: notify

 /**
  * @param Rfc $rfc
  * @param array $voteDiff
  */
 public function notify(Rfc $rfc, array $voteDiff)
 {
     foreach ($this->emailSubscriberRepository->findAll() as $subscriber) {
         $email = $this->twig->render('rfc.twig', ['rfcName' => $rfc->getName(), 'details' => $voteDiff['details'], 'changeLog' => $voteDiff['changeLog'], 'voteDiffs' => $voteDiff['votes'], 'rfcVotes' => $rfc->getVotes(), 'unsubscribeUrl' => sprintf('%s/unsubscribe/%s', $this->config->get('app.url'), $subscriber->getUnsubscribeToken())]);
         $message = $this->mailer->createMessage()->setSubject(sprintf('%s updated!', $rfc->getName()))->setFrom('notifier@php-rfc-digestor.com')->setTo($subscriber->getEmail())->setBody($email, 'text/html');
         $this->mailer->send($message);
     }
 }
开发者ID:shakyShane,项目名称:php-rfc-digestor,代码行数:12,代码来源:EmailRfcNotifier.php

示例6: getZones

 /**
  * Gets all zones
  *
  * @param string|null $scope
  *
  * @return array $zones
  */
 protected function getZones($scope = null)
 {
     if (null === $scope) {
         return $this->repository->findAll();
     }
     return $this->repository->findBy(array('scope' => $scope));
 }
开发者ID:bcremer,项目名称:Sylius,代码行数:14,代码来源:ZoneMatcher.php

示例7: initRoutes

 private function initRoutes()
 {
     $redirects = $this->redirectRepository->findAll();
     foreach ($redirects as $redirect) {
         /** @var Redirect $redirect */
         $this->routeCollection->add('_redirect_route_' . $redirect->getId(), new Route($redirect->getOrigin(), array('_controller' => 'FrameworkBundle:Redirect:urlRedirect', 'path' => $redirect->getTarget(), 'permanent' => $redirect->isPermanent())));
     }
 }
开发者ID:headonkeyboard,项目名称:KunstmaanBundlesCMS,代码行数:8,代码来源:RedirectRouter.php

示例8: validateObjects

 /**
  * @param ObjectRepository $repository The entity repository
  * @param string           $type       Type is used to display errors if needed
  */
 protected function validateObjects(ObjectRepository $repository, $type)
 {
     $validator = $this->getService('validator');
     $entities = $repository->findAll();
     foreach ($entities as $entity) {
         $violations = $validator->validate($entity);
         if (0 !== $violations->count()) {
             $this->addErrors($violations, $entity, $type);
         }
     }
 }
开发者ID:abdeldayem,项目名称:pim-community-dev,代码行数:15,代码来源:ValidateObjectsCommand.php

示例9: getRules

 /**
  * Here we read rules from DB and put them into an a form that BjyAuthorize's Controller.php understands
  */
 public function getRules()
 {
     //read from object store a set of (role, controller, action)
     $result = $this->objectRepository->findAll();
     //transform to object BjyAuthorize will understand
     $rules = array();
     foreach ($result as $key => $rule) {
         $role = $rule->getRole()->getRoleId();
         $controller = $rule->getController();
         $action = $rule->getAction();
         if ($action === 'all') {
             $rules[$controller]['roles'][] = $role;
             $rules[$controller]['controller'] = array($controller);
         } else {
             $rules[$controller . ':' . $action]['roles'][] = $role;
             $rules[$controller . ':' . $action]['controller'] = array($controller);
             $rules[$controller . ':' . $action]['action'] = array($action);
         }
     }
     return array_values($rules);
 }
开发者ID:sudar69,项目名称:hermes,代码行数:24,代码来源:DoctrineRuleProvider.php

示例10: initRoutes

 private function initRoutes()
 {
     $redirects = $this->redirectRepository->findAll();
     $domain = $this->domainConfiguration->getHost();
     /** @var Redirect $redirect */
     foreach ($redirects as $redirect) {
         // Only add the route when the domain matches or the domain is empty
         if ($redirect->getDomain() == $domain || !$redirect->getDomain()) {
             $this->routeCollection->add('_redirect_route_' . $redirect->getId(), new Route($redirect->getOrigin(), array('_controller' => 'FrameworkBundle:Redirect:urlRedirect', 'path' => $redirect->getTarget(), 'permanent' => $redirect->isPermanent())));
         }
     }
 }
开发者ID:hyrmedia,项目名称:KunstmaanBundlesCMS,代码行数:12,代码来源:RedirectRouter.php

示例11: notify

 /**
  * @param Rfc $rfc
  * @param array $voteDiff
  */
 public function notify(Rfc $rfc, array $voteDiff)
 {
     $attachments = [];
     foreach ($voteDiff['votes'] as $title => $voteDiffs) {
         $attachment = ['text' => $title, 'color' => 'good', 'fields' => []];
         if (!empty($voteDiffs['new'])) {
             $newVotes = array_map(function ($voter, $vote) {
                 return sprintf('%s: %s', $voter, $vote);
             }, array_keys($voteDiffs['new']), $voteDiffs['new']);
             $attachment['fields'][] = ['title' => 'New Votes', 'value' => implode(", ", $newVotes)];
         }
         if (!empty($voteDiffs['updated'])) {
             $updatedVotes = array_map(function ($voter, $vote) {
                 return sprintf('%s: %s', $voter, $vote);
             }, array_keys($voteDiffs['updated']), $voteDiffs['updated']);
             $attachment['fields'][] = ['title' => 'Updated Votes', 'value' => implode(", ", $updatedVotes)];
         }
         $counts = [];
         foreach ($rfc->getVotes()[$title]['counts'] as $header => $standing) {
             if ($header === 'Real name') {
                 continue;
             }
             $counts[$header] = $standing;
         }
         $counts = array_map(function ($vote, $count) {
             return sprintf('%s: %s', $vote, $count);
         }, array_keys($counts), $counts);
         $attachment['fields'][] = ['title' => 'Current Standings', 'value' => implode(", ", $counts)];
         $attachments[] = $attachment;
     }
     $message = ['text' => sprintf("*PHP RFC Updates for %s*", $rfc->getName()), 'username' => 'PHP RFC Digestor', 'icon_url' => 'http://php.net/images/logos/php.ico', 'attachments' => json_encode($attachments)];
     foreach ($this->slackSubscriberRepository->findAll() as $slackSubscriber) {
         $this->commander->setToken($slackSubscriber->getToken());
         $message['channel'] = '#' . $slackSubscriber->getChannel();
         $this->commander->execute('chat.postMessage', $message);
     }
 }
开发者ID:shakyShane,项目名称:php-rfc-digestor,代码行数:41,代码来源:SlackRfcNotifier.php

示例12: getStates

 /**
  * @return array
  */
 public function getStates()
 {
     return $this->usStatesRepository->findAll();
 }
开发者ID:chateaux,项目名称:toolbox,代码行数:7,代码来源:UsStatesService.php

示例13: getResults

 /**
  * @return \ArrayIterator
  */
 protected function getResults()
 {
     return new \ArrayIterator($this->repository->findAll());
 }
开发者ID:abdeldayem,项目名称:pim-community-dev,代码行数:7,代码来源:BaseReader.php

示例14: findPackages

 /**
  * {@inheritdoc}
  */
 public function findPackages()
 {
     return $this->repository->findAll();
 }
开发者ID:hyperunknown,项目名称:baboon-subscription-bundle,代码行数:7,代码来源:PackageManager.php

示例15: getCategories

 /**
  * @return mixed
  */
 public function getCategories()
 {
     return $this->repository->findAll();
 }
开发者ID:spoonx,项目名称:sxblog,代码行数:7,代码来源:CategoryService.php


注:本文中的Doctrine\Common\Persistence\ObjectRepository::findAll方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。