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


PHP ManagerRegistry::getRepository方法代码示例

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


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

示例1: execute

 /**
  * Executes a job with given payload
  *
  * @param  array $payload
  * @return mixed
  */
 public function execute(array $payload)
 {
     list($entityClass, $entityId) = $payload;
     $entity = $this->doctrine->getRepository($entityClass)->find($entityId);
     if (null === $entity) {
         return false;
     }
     return $this->exporter->cacheItem($entity);
 }
开发者ID:mvanduijker,项目名称:FMIoBundle,代码行数:15,代码来源:ExportEntityExecutor.php

示例2: getConfiguration

 /**
  * {@inheritdoc}
  */
 public function getConfiguration($gridName)
 {
     if (empty($this->configuration[$gridName])) {
         $id = intval(substr($gridName, strlen(Segment::GRID_PREFIX)));
         $segmentRepository = $this->doctrine->getRepository('OroSegmentBundle:Segment');
         $segment = $segmentRepository->find($id);
         $this->builder->setGridName($gridName);
         $this->builder->setSource($segment);
         $this->configuration[$gridName] = $this->builder->getConfiguration();
     }
     return $this->configuration[$gridName];
 }
开发者ID:Maksold,项目名称:platform,代码行数:15,代码来源:ConfigurationProvider.php

示例3: getConfiguration

 /**
  * {@inheritdoc}
  */
 public function getConfiguration($gridName)
 {
     if ($this->configuration === null) {
         $id = intval(substr($gridName, strlen(Report::GRID_PREFIX)));
         $repo = $this->doctrine->getRepository('OroReportBundle:Report');
         $report = $repo->find($id);
         $this->builder->setGridName($gridName);
         $this->builder->setSource($report);
         $this->configuration = $this->builder->getConfiguration();
     }
     return $this->configuration;
 }
开发者ID:Maksold,项目名称:platform,代码行数:15,代码来源:ReportDatagridConfigurationProvider.php

示例4: getMarketingListItem

 /**
  * @param MarketingList $marketingList
  * @param int $entityId
  * @return MarketingListItem
  */
 public function getMarketingListItem(MarketingList $marketingList, $entityId)
 {
     $marketingListItemRepository = $this->registry->getRepository(self::MARKETING_LIST_ITEM_ENTITY);
     $marketingListItem = $marketingListItemRepository->findOneBy(['marketingList' => $marketingList, 'entityId' => $entityId]);
     if (!$marketingListItem) {
         $marketingListItem = new MarketingListItem();
         $marketingListItem->setMarketingList($marketingList)->setEntityId($entityId);
         $manager = $this->registry->getManagerForClass(self::MARKETING_LIST_ITEM_ENTITY);
         $manager->persist($marketingListItem);
     }
     return $marketingListItem;
 }
开发者ID:antrampa,项目名称:crm,代码行数:17,代码来源:MarketingListItemConnector.php

示例5: preSubmitData

 /**
  * @param FormEvent $event
  */
 public function preSubmitData(FormEvent $event)
 {
     $data = $event->getData();
     if (!isset($data['product'], $data['unit'], $data['quantity'])) {
         return;
     }
     /** @var Product $product */
     $product = $this->registry->getRepository($this->productClass)->find($data['product']);
     if ($product) {
         $unitPrecision = $product->getUnitPrecision($data['unit']);
         if ($unitPrecision) {
             $data['quantity'] = $this->roundingService->round($data['quantity'], $unitPrecision->getPrecision());
             $event->setData($data);
         }
     }
 }
开发者ID:hafeez3000,项目名称:orocommerce,代码行数:19,代码来源:LineItemType.php

示例6: __invoke

 /**
  * Retrieves a collection of resources.
  *
  * @param Request $request
  *
  * @return array|\Dunglas\ApiBundle\Model\PaginatorInterface|\Traversable
  *
  * @throws RuntimeException|RootNodeNotFoundException
  */
 public function __invoke(Request $request)
 {
     list($resourceType) = $this->extractAttributes($request);
     /**
      * @var ResourceInterface $resourceType
      */
     $repository = $this->manager->getRepository($resourceType->getEntityClass());
     /**
      * @var $repository AbstractTreeRepository
      */
     $rootNodes = $repository->getRootNodes();
     if (count($rootNodes) == 0) {
         throw new RootNodeNotFoundException();
     }
     $rootNode = reset($rootNodes);
     return $rootNode;
 }
开发者ID:fulcrum3d,项目名称:PartKeepr,代码行数:26,代码来源:GetRootNodeAction.php

示例7: sync

 /**
  * Syncs email bodies
  *
  * @param int $maxExecTimeInMin
  * @param int $batchSize
  */
 public function sync($maxExecTimeInMin = -1, $batchSize = 10)
 {
     $repo = $this->doctrine->getRepository('OroEmailBundle:Email');
     $maxExecTimeout = $maxExecTimeInMin > 0 ? new \DateInterval('PT' . $maxExecTimeInMin . 'M') : false;
     $startTime = new \DateTime('now', new \DateTimeZone('UTC'));
     while (true) {
         if ($maxExecTimeout !== false) {
             $date = new \DateTime('now', new \DateTimeZone('UTC'));
             if ($date->sub($maxExecTimeout) >= $startTime) {
                 $this->logger->notice('Exit because allocated time frame elapsed.');
                 break;
             }
         }
         $emails = $repo->getEmailsWithoutBody($batchSize);
         if (count($emails) === 0) {
             $this->logger->notice('All emails was processed');
             break;
         }
         $batchStartTime = new \DateTime('now', new \DateTimeZone('UTC'));
         /** @var Email $email */
         foreach ($emails as $email) {
             try {
                 $this->syncOneEmailBody($email);
                 $this->logger->notice(sprintf('The "%s" (ID: %d) email body was synced.', $email->getSubject(), $email->getId()));
             } catch (\Exception $e) {
                 // in case of exception, we should save state that email body was synced.
                 $this->getManager()->persist($email);
                 continue;
             }
         }
         $this->getManager()->flush();
         $this->getManager()->clear();
         $currentTime = new \DateTime('now', new \DateTimeZone('UTC'));
         $diff = $currentTime->diff($batchStartTime);
         $this->logger->info(sprintf('Batch save time: %s.', $diff->format('%i minutes %s seconds')));
     }
 }
开发者ID:paulstoica,项目名称:platform,代码行数:43,代码来源:EmailBodySynchronizer.php

示例8: getJobInstanceRepository

 /**
  * @return EntityRepository
  */
 protected function getJobInstanceRepository()
 {
     return $this->managerRegistry->getRepository('AkeneoBatchBundle:JobInstance');
 }
开发者ID:antrampa,项目名称:platform,代码行数:7,代码来源:JobExecutor.php

示例9: getPageRepository

 /**
  * Get the Pages Repository
  *
  * @return PageRepository
  */
 private function getPageRepository()
 {
     return $this->em->getRepository('KRSolutionsKRCMSBundle:Page');
 }
开发者ID:kr-solutions,项目名称:krcms-bundle,代码行数:9,代码来源:MenuTwigExtension.php

示例10: getDislikes

 /**
  * Renvoie le nombre de "j'aime pas"
  * @param  Post   $post
  * @return int
  */
 public function getDislikes(Post $post)
 {
     $repository = $this->doctrine->getRepository('LpdwBundle:PostLike');
     return $repository->getCountLikes($post, -1);
 }
开发者ID:Peekmo,项目名称:lpdw-sources,代码行数:10,代码来源:LikeManager.php


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