當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。