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


PHP Doctrine\ManagerRegistry类代码示例

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


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

示例1: __construct

 /**
  * DiffManager constructor.
  * @param ManagerRegistry $managerRegistry
  * @param string          $recolnatAlias
  * @param string          $recolnatBufferAlias
  */
 public function __construct(ManagerRegistry $managerRegistry, $recolnatAlias, $recolnatBufferAlias)
 {
     $this->managerRegistry = $managerRegistry;
     $this->em = $managerRegistry->getManager('default');
     $this->recolnatAlias = $recolnatAlias;
     $this->recolnatBufferAlias = $recolnatBufferAlias;
 }
开发者ID:e-ReColNat,项目名称:recolnat-diff,代码行数:13,代码来源:DiffManager.php

示例2: it_should_have_doctrine_data_indexer

 /**
  * @param \Symfony\Bridge\Doctrine\ManagerRegistry $registry
  * @param \Doctrine\Common\Persistence\ObjectManager $om
  * @param \Doctrine\Common\Persistence\ObjectRepository $repository
  * @param \Doctrine\ORM\Mapping\ClassMetadata $metadata
  */
 public function it_should_have_doctrine_data_indexer($registry, $om, $repository, $metadata)
 {
     $registry->getManagerForClass('FSi/Bundle/DemoBundle/Entity/Entity')->willReturn($om);
     $om->getRepository('FSiDemoBundle:Entity')->willReturn($repository);
     $metadata->isMappedSuperclass = false;
     $metadata->rootEntityName = 'FSi/Bundle/DemoBundle/Entity/Entity';
     $om->getClassMetadata('FSi/Bundle/DemoBundle/Entity/Entity')->willReturn($metadata);
     $repository->getClassName()->willReturn('FSi/Bundle/DemoBundle/Entity/Entity');
     $this->setManagerRegistry($registry);
     $this->getDataIndexer()->shouldReturnAnInstanceOf('FSi\\Component\\DataIndexer\\DoctrineDataIndexer');
 }
开发者ID:kbedn,项目名称:admin-bundle,代码行数:17,代码来源:DeleteElementSpec.php

示例3: finishView

 /**
  * {@inheritdoc}
  */
 public function finishView(FormView $view, FormInterface $form, array $options)
 {
     /** @var ShoppingListRepository $shoppingListRepository */
     $shoppingListRepository = $currentShoppingList = $this->registry->getManagerForClass($this->shoppingListClass)->getRepository($this->shoppingListClass);
     $currentShoppingList = $shoppingListRepository->findCurrentForAccountUser($this->getAccountUser());
     $view->children['shoppingList']->vars['currentShoppingList'] = $currentShoppingList;
 }
开发者ID:adam-paterson,项目名称:orocommerce,代码行数:10,代码来源:FrontendLineItemWidgetType.php

示例4: setUpDoctrine

 /**
  */
 protected function setUpDoctrine()
 {
     static::bootKernel();
     $this->container = static::$kernel->getContainer();
     $this->doctrine = $this->createDoctrineRegistry();
     $this->em = $this->doctrine->getManager();
     $this->loader = new Loader();
 }
开发者ID:jasongrimes,项目名称:stressmonkey,代码行数:10,代码来源:DoctrineTraits.php

示例5: getClassMetadata

 /**
  * Returns a metadata for the given entity
  *
  * @param string $className
  * @return ClassMetadata
  */
 protected function getClassMetadata($className)
 {
     if (isset($this->classMetadataLocalCache[$className])) {
         return $this->classMetadataLocalCache[$className];
     }
     $classMetadata = $this->doctrine->getManagerForClass($className)->getClassMetadata($className);
     $this->classMetadataLocalCache[$className] = $classMetadata;
     return $classMetadata;
 }
开发者ID:ashutosh-srijan,项目名称:findit_akeneo,代码行数:15,代码来源:AbstractOrmQueryConverter.php

示例6: 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

示例7: getQueryBuilder

 /**
  * {@inheritdoc}
  */
 public function getQueryBuilder(Segment $segment)
 {
     $converter = new SegmentQueryConverter($this->manager, $this->virtualFieldProvider, $this->doctrine, $this->restrictionBuilder);
     if ($this->virtualRelationProvider) {
         $converter->setVirtualRelationProvider($this->virtualRelationProvider);
     }
     /** @var EntityManager  $em */
     $em = $this->doctrine->getManagerForClass($segment->getEntity());
     $qb = $converter->convert(new RestrictionSegmentProxy($segment, $em));
     return $qb;
 }
开发者ID:Maksold,项目名称:platform,代码行数:14,代码来源:DynamicSegmentQueryBuilder.php

示例8: deserializeIdCollectionFromJson

 /**
  * @param JsonDeserializationVisitor $visitor
  * @param $data
  * @param array $type
  * @return ArrayCollection
  */
 public function deserializeIdCollectionFromJson(JsonDeserializationVisitor $visitor, $data, array $type)
 {
     $collection = new ArrayCollection();
     $class = $type['params'][0]['name'];
     /** @var \Doctrine\Common\Persistence\ObjectRepository $repository */
     $repository = $this->doctrine->getManagerForClass($class)->getRepository($class);
     foreach ($data as $key => $value) {
         $collection->add($repository->findOneBy(array('id' => $value)));
     }
     return $collection;
 }
开发者ID:stanlemon,项目名称:rest-bundle,代码行数:17,代码来源:IdCollectionHandler.php

示例9: 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

示例10: 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

示例11: 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

示例12: testGetDeleteMessageTextForDataGrid

 public function testGetDeleteMessageTextForDataGrid()
 {
     $paymentTermId = 1;
     $paymentTermRepository = $this->getMockBuilder('OroB2B\\Bundle\\PaymentBundle\\Entity\\Repository\\PaymentTermRepository')->disableOriginalConstructor()->getMock();
     $paymentTermRepository->expects($this->once())->method('find')->with($paymentTermId)->willReturnCallback(function ($id) {
         return new PaymentTermStub($id);
     });
     $om = $this->getMock('\\Doctrine\\Common\\Persistence\\ObjectManager');
     $om->expects($this->once())->method('getRepository')->with($this->equalTo('OroB2BPaymentBundle:PaymentTerm'))->willReturn($paymentTermRepository);
     $this->managerRegistry->expects($this->once())->method('getManagerForClass')->with($this->equalTo('OroB2BPaymentBundle:PaymentTerm'))->willReturn($om);
     $message = $this->extension->getDeleteMessageTextForDataGrid($paymentTermId);
     $this->assertDeleteMessage($message, $paymentTermId, 0, 0);
 }
开发者ID:adam-paterson,项目名称:orocommerce,代码行数:13,代码来源:DeleteMessageTextGeneratorTest.php

示例13: buildForm

 /**
  * {@inheritdoc}
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $em = $this->registry->getManagerForClass($this->integrationEntityFQCN);
     $formFactory = $builder->getFormFactory();
     $data = $builder->create('data', 'hidden');
     $data->addViewTransformer(new ArrayToJsonTransformer());
     $identifier = $builder->create('identifier', 'hidden');
     $identifier->addViewTransformer(new EntityToIdTransformer($em, $this->integrationEntityFQCN));
     $builder->addViewTransformer(new DatasourceDataTransformer($formFactory));
     $builder->add($data);
     $builder->add($identifier);
     $builder->add('type', 'hidden', ['data' => $options['type']]);
     $builder->add('name', 'hidden');
 }
开发者ID:antrampa,项目名称:crm,代码行数:17,代码来源:ChannelDatasourceType.php

示例14: 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

示例15: send

 public function send()
 {
     $this->assertTransport();
     $marketingList = $this->emailCampaign->getMarketingList();
     /** @var EntityManager $manager */
     $manager = $this->registry->getManager();
     foreach ($this->getIterator() as $entity) {
         $to = $this->contactInformationFieldsProvider->getQueryContactInformationFields($marketingList->getSegment(), $entity, ContactInformationFieldsProvider::CONTACT_INFORMATION_SCOPE_EMAIL);
         try {
             $manager->beginTransaction();
             // Do actual send
             $this->transport->send($this->emailCampaign, $entity, [$this->getSenderEmail() => $this->getSenderName()], $to);
             // Mark marketing list item as contacted
             $marketingListItem = $this->marketingListItemConnector->contact($marketingList, $entity->getId());
             // Record email campaign contact statistic
             $statisticsRecord = new EmailCampaignStatistics();
             $statisticsRecord->setEmailCampaign($this->emailCampaign)->setMarketingListItem($marketingListItem);
             $manager->persist($statisticsRecord);
             $manager->flush();
             $manager->commit();
         } catch (\Exception $e) {
             $manager->rollback();
             if ($this->logger) {
                 $this->logger->error(sprintf('Email sending to "%s" failed.', implode(', ', $to)), array('exception' => $e));
             }
         }
     }
     $this->emailCampaign->setSent(true);
     $manager->persist($this->emailCampaign);
     $manager->flush();
 }
开发者ID:dairdr,项目名称:crm,代码行数:31,代码来源:EmailCampaignSender.php


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