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


PHP DoctrineHelper::getEntityReference方法代码示例

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


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

示例1: onAccountGroupView

 /**
  * @param BeforeListRenderEvent $event
  */
 public function onAccountGroupView(BeforeListRenderEvent $event)
 {
     if (!$this->request) {
         return;
     }
     $groupId = (int) $this->request->get('id');
     /** @var AccountGroup $group */
     $group = $this->doctrineHelper->getEntityReference('OroB2BAccountBundle:AccountGroup', $groupId);
     $paymentTermRepository = $this->getPaymentTermRepository();
     $paymentTerm = $paymentTermRepository->getOnePaymentTermByAccountGroup($group);
     $paymentTermData = ['paymentTerm' => $paymentTerm, 'paymentTermLabel' => $paymentTerm ? $paymentTerm->getLabel() : null, 'empty' => $this->translator->trans('N/A'), 'defineToTheGroup' => false];
     $template = $event->getEnvironment()->render('OroB2BPaymentBundle:Account:payment_term_view.html.twig', ['paymentTermData' => $paymentTermData]);
     $event->getScrollData()->addSubBlockData(0, 0, $template);
 }
开发者ID:adam-paterson,项目名称:orocommerce,代码行数:17,代码来源:FormViewListener.php

示例2: onProductView

 /**
  * @param BeforeListRenderEvent $event
  */
 public function onProductView(BeforeListRenderEvent $event)
 {
     if (!$this->request) {
         return;
     }
     $productId = $this->request->get('id');
     /** @var Product $product */
     $product = $this->doctrineHelper->getEntityReference('OroB2BProductBundle:Product', $productId);
     /** @var CategoryRepository $repository */
     $repository = $this->doctrineHelper->getEntityRepository('OroB2BCatalogBundle:Category');
     $category = $repository->findOneByProduct($product);
     $template = $event->getEnvironment()->render('OroB2BCatalogBundle:Product:category_view.html.twig', ['entity' => $category]);
     $this->addCategoryBlock($event->getScrollData(), $template);
 }
开发者ID:hafeez3000,项目名称:orocommerce,代码行数:17,代码来源:FormViewListener.php

示例3: onFrontendProductView

 /**
  * @param BeforeListRenderEvent $event
  */
 public function onFrontendProductView(BeforeListRenderEvent $event)
 {
     if (!$this->request) {
         return;
     }
     $productId = (int) $this->request->get('id');
     if (!$productId) {
         return;
     }
     if (!$this->doctrineHelper->getEntityReference('OroB2BProductBundle:Product', $productId)) {
         return;
     }
     $template = $event->getEnvironment()->render('OroB2BShoppingListBundle:Product/Frontend:view.html.twig', ['productId' => $productId]);
     $this->addShoppingListBlock($event->getScrollData(), $template);
 }
开发者ID:adam-paterson,项目名称:orocommerce,代码行数:18,代码来源:FormViewListener.php

示例4: getEntityFromRequestId

 /**
  * @param $className
  * @return null|object
  */
 protected function getEntityFromRequestId($className)
 {
     if (!$this->request) {
         return null;
     }
     $entityId = (int) $this->request->get('id');
     if (!$entityId) {
         return null;
     }
     $entity = $this->doctrineHelper->getEntityReference($className, $entityId);
     if (!$entity) {
         return null;
     }
     return $entity;
 }
开发者ID:adam-paterson,项目名称:orocommerce,代码行数:19,代码来源:FormViewListener.php

示例5: deserialize

 /**
  * Deserialize data of WorkflowItem
  *
  * @param WorkflowItem $workflowItem
  */
 protected function deserialize(WorkflowItem $workflowItem)
 {
     // Pass serializer into $workflowItem to make lazy loading of workflow item data.
     $workflowItem->setSerializer($this->serializer, $this->format);
     // Set related entity
     $relatedEntity = $this->doctrineHelper->getEntityReference($workflowItem->getDefinition()->getRelatedEntity(), $workflowItem->getEntityId());
     $workflowItem->setEntity($relatedEntity);
 }
开发者ID:Maksold,项目名称:platform,代码行数:13,代码来源:WorkflowDataSerializeListener.php

示例6: testGetEntityReference

 public function testGetEntityReference()
 {
     $expectedResult = $this->getMock('MockEntityReference');
     $entityClass = 'MockEntity';
     $entityId = 100;
     $this->em->expects($this->once())->method('getReference')->with($entityClass, $entityId)->will($this->returnValue($expectedResult));
     $this->registry->expects($this->any())->method('getManagerForClass')->with($entityClass)->will($this->returnValue($this->em));
     $this->assertEquals($expectedResult, $this->doctrineHelper->getEntityReference($entityClass, $entityId));
 }
开发者ID:xamin123,项目名称:platform,代码行数:9,代码来源:DoctrineHelperTest.php

示例7: getEntityReference

 /**
  * Returns the reference to the entity object by its class name and id
  *
  * If entity id is not specified the reference to the new entity object is returned
  *
  * @param string     $entityClass The class name. Also the _ char can be used instead of \
  * @param mixed|null $entityId    The object id
  *
  * @return object The entity reference
  *
  * @throws BadRequestHttpException
  */
 public function getEntityReference($entityClass, $entityId = null)
 {
     $entityClass = $this->decodeClassName($entityClass);
     try {
         $entity = $entityId ? $this->doctrineHelper->getEntityReference($entityClass, $entityId) : $this->doctrineHelper->createEntityInstance($entityClass);
     } catch (NotManageableEntityException $e) {
         throw new BadRequestHttpException($e->getMessage(), $e);
     }
     return $entity;
 }
开发者ID:xamin123,项目名称:platform,代码行数:22,代码来源:EntityRoutingHelper.php

示例8: onProductView

 /**
  * @param BeforeListRenderEvent $event
  */
 public function onProductView(BeforeListRenderEvent $event)
 {
     if (!$this->request) {
         return;
     }
     $productId = $this->request->get('id');
     /** @var Customer $customer */
     $product = $this->doctrineHelper->getEntityReference('OroB2BProductBundle:Product', $productId);
     $template = $event->getEnvironment()->render('OroB2BPricingBundle:Product:prices_view.html.twig', ['entity' => $product]);
     $this->addProductPricesBlock($event->getScrollData(), $template);
 }
开发者ID:hafeez3000,项目名称:orocommerce,代码行数:14,代码来源:FormViewListener.php

示例9: onFrontendProductView

 /**
  * @param BeforeListRenderEvent $event
  */
 public function onFrontendProductView(BeforeListRenderEvent $event)
 {
     if (!$this->request) {
         return;
     }
     $productId = (int) $this->request->get('id');
     /** @var Product $product */
     $product = $this->doctrineHelper->getEntityReference('OroB2BProductBundle:Product', $productId);
     $priceList = $this->frontendPriceListRequestHandler->getPriceList();
     /** @var ProductPriceRepository $priceRepository */
     $priceRepository = $this->doctrineHelper->getEntityRepository('OroB2BPricingBundle:ProductPrice');
     $prices = $priceRepository->findByPriceListIdAndProductIds($priceList->getId(), [$product->getId()]);
     $template = $event->getEnvironment()->render('OroB2BPricingBundle:Frontend/Product:productPrice.html.twig', ['prices' => $prices]);
     $scrollData = $event->getScrollData();
     $subBlockId = $scrollData->addSubBlock(0);
     $scrollData->addSubBlockData(0, $subBlockId, $template);
 }
开发者ID:adam-paterson,项目名称:orocommerce,代码行数:20,代码来源:FormViewListener.php

示例10: fillEntityData

 /**
  * @param object $entity
  * @param array $data
  */
 protected function fillEntityData($entity, array $data = [])
 {
     if (!$data) {
         return;
     }
     if (!$this->propertyAccessor) {
         $this->propertyAccessor = PropertyAccess::createPropertyAccessor();
     }
     $metadata = $this->doctrineHelper->getEntityMetadata($entity);
     foreach ($data as $property => $value) {
         try {
             if ($metadata->hasAssociation($property)) {
                 $value = $this->doctrineHelper->getEntityReference($metadata->getAssociationTargetClass($property), $value);
             }
             $this->propertyAccessor->setValue($entity, $property, $value);
         } catch (NoSuchPropertyException $e) {
         }
     }
 }
开发者ID:adam-paterson,项目名称:orocommerce,代码行数:23,代码来源:AbstractProductDataStorageExtension.php

示例11: getEntityById

 /**
  * @param int|string $id
  * @return object
  */
 protected function getEntityById($id)
 {
     return $this->doctrineHelper->getEntityReference($this->class, $id);
 }
开发者ID:ramunasd,项目名称:platform,代码行数:8,代码来源:EntityChangesetTransformer.php

示例12: getEntityReference

 /**
  * @param object $entity
  * @return object
  */
 public function getEntityReference($entity)
 {
     $entityName = ClassUtils::getClass($entity);
     $identifier = $this->getIdentifier($entity);
     return $this->doctrineHelper->getEntityReference($entityName, $identifier);
 }
开发者ID:northdakota,项目名称:platform,代码行数:10,代码来源:DatabaseHelper.php

示例13: getEnumValueByCode

 /**
  * @param string $enumCode
  * @param string $id
  * @return AbstractEnumValue
  */
 public function getEnumValueByCode($enumCode, $id)
 {
     $enumClass = ExtendHelper::buildEnumValueClassName($enumCode);
     return $this->doctrineHelper->getEntityReference($enumClass, $id);
 }
开发者ID:Maksold,项目名称:platform,代码行数:10,代码来源:EnumValueProvider.php


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