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


PHP Context\UserContext类代码示例

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


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

示例1: let

 function let(UserContext $userContext, EntityManager $em, ClassMetadata $classMetadata)
 {
     $classMetadata->name = 'group_type';
     $userContext->getCurrentLocaleCode()->willReturn('en_US');
     $em->getClassMetadata('groupTypeClass')->willReturn($classMetadata);
     $this->beConstructedWith($userContext, $em, 'groupTypeClass');
 }
开发者ID:a2xchip,项目名称:pim-community-dev,代码行数:7,代码来源:GroupTypeRepositorySpec.php

示例2: let

 function let(SecurityContextInterface $securityContext, AddLocaleListener $listener, CatalogContext $catalogContext, UserContext $userContext, GetResponseEvent $event)
 {
     $securityContext->getToken()->willReturn(true);
     $event->getRequestType()->willReturn(HttpKernel::MASTER_REQUEST);
     $userContext->getCurrentLocaleCode()->willReturn('de_DE');
     $userContext->getUserChannelCode()->willReturn('schmetterling');
     $this->beConstructedWith($securityContext, $listener, $catalogContext, $userContext);
 }
开发者ID:javiersantos,项目名称:pim-community-dev,代码行数:8,代码来源:UserContextListenerSpec.php

示例3: let

 function let(UserContext $userContext, EntityManager $em, ClassMetadata $classMetadata, EventManager $eventManager, TreeListener $treeListener, Nested $strategy)
 {
     $classMetadata->name = 'category';
     $userContext->getCurrentLocaleCode()->willReturn('en_US');
     $em->getEventManager()->willReturn($eventManager);
     $eventManager->getListeners()->willReturn([[$treeListener]]);
     $treeListener->getStrategy(Argument::cetera())->willReturn($strategy);
     $treeListener->getConfiguration(Argument::cetera())->willReturn(['parent' => 'parent', 'left' => 'left']);
     $this->beConstructedWith($userContext, $em, $classMetadata);
 }
开发者ID:a2xchip,项目名称:pim-community-dev,代码行数:10,代码来源:CategoryRepositorySpec.php

示例4: let

 function let(ProductBuilder $productBuilder, ProductUpdaterInterface $productUpdater, UserContext $userContext, LocaleInterface $en, LocaleInterface $de, ProductValueInterface $productValue, CatalogContext $catalogContext, ProductMassActionManager $massActionManager, NormalizerInterface $normalizer, BulkSaverInterface $productSaver)
 {
     $en->getCode()->willReturn('en_US');
     $de->getCode()->willReturn('de_DE');
     $userContext->getCurrentLocale()->willReturn($en);
     $userContext->getUserLocales()->willReturn([$en, $de]);
     $catalogContext->setLocaleCode(Argument::any())->willReturn($catalogContext);
     $productValue->setAttribute(Argument::any())->willReturn($productValue);
     $productValue->setLocale(Argument::any())->willReturn($productValue);
     $productValue->setScope(Argument::any())->willReturn($productValue);
     $productValue->addPrice(Argument::any())->willReturn($productValue);
     $this->beConstructedWith($productBuilder, $productUpdater, $userContext, $catalogContext, $massActionManager, $normalizer, $productSaver, ['product_price' => 'Pim\\Bundle\\CatalogBundle\\Model\\ProductPrice', 'product_media' => 'Pim\\Bundle\\CatalogBundle\\Model\\ProductMedia']);
 }
开发者ID:ashutosh-srijan,项目名称:findit_akeneo,代码行数:13,代码来源:EditCommonAttributesSpec.php

示例5: let

 function let(ProductManager $productManager, UserContext $userContext, CurrencyManager $currencyManager, Locale $en, Locale $de, AttributeRepository $attributeRepository, AbstractProductValue $productValue, CatalogContext $catalogContext, ProductBuilder $productBuilder, ProductMassActionManager $massActionManager, MetricFactory $metricFactory)
 {
     $en->getCode()->willReturn('en_US');
     $de->getCode()->willReturn('de_DE');
     $userContext->getCurrentLocale()->willReturn($en);
     $userContext->getUserLocales()->willReturn([$en, $de]);
     $catalogContext->setLocaleCode(Argument::any())->willReturn($catalogContext);
     $productManager->createProductValue()->willReturn($productValue);
     $productValue->setAttribute(Argument::any())->willReturn($productValue);
     $productValue->setLocale(Argument::any())->willReturn($productValue);
     $productValue->setScope(Argument::any())->willReturn($productValue);
     $productValue->addPrice(Argument::any())->willReturn($productValue);
     $productManager->getAttributeRepository()->willReturn($attributeRepository);
     $this->beConstructedWith($productManager, $userContext, $currencyManager, $catalogContext, $productBuilder, $massActionManager, $metricFactory, ['product_price' => 'Pim\\Bundle\\CatalogBundle\\Model\\ProductPrice', 'product_media' => 'Pim\\Bundle\\CatalogBundle\\Model\\ProductMedia']);
 }
开发者ID:javiersantos,项目名称:pim-community-dev,代码行数:15,代码来源:EditCommonAttributesSpec.php

示例6: countNotifications

 /**
  * Return the number of unread notifications for the currently logged in user
  *
  * @return int
  */
 public function countNotifications()
 {
     $user = $this->userContext->getUser();
     if (null === $user) {
         return 0;
     }
     return $this->manager->countUnreadForUser($user);
 }
开发者ID:abdeldayem,项目名称:pim-community-dev,代码行数:13,代码来源:NotificationExtension.php

示例7: completenessAction

 /**
  * Displays completeness for a product
  *
  * @param int $id
  *
  * @return Response
  */
 public function completenessAction($id)
 {
     $product = $this->productManager->getProductRepository()->getFullProduct($id);
     $channels = $this->channelManager->getFullChannels();
     $locales = $this->userContext->getUserLocales();
     $completenesses = $this->completenessManager->getProductCompleteness($product, $channels, $locales, $this->userContext->getCurrentLocale()->getCode());
     return $this->templating->renderResponse('PimEnrichBundle:Completeness:_completeness.html.twig', array('product' => $product, 'channels' => $channels, 'locales' => $locales, 'completenesses' => $completenesses));
 }
开发者ID:noglitchyo,项目名称:pim-community-dev,代码行数:15,代码来源:CompletenessController.php

示例8: getMetadata

 /**
  * {@inheritdoc}
  */
 public function getMetadata()
 {
     $metadata = parent::getMetadata();
     $defaultScope = $this->userContext->getUserChannel();
     $metadata['populateDefault'] = false;
     unset($metadata['placeholder']);
     return $metadata;
 }
开发者ID:a2xchip,项目名称:pim-community-dev,代码行数:11,代码来源:ScopeFilter.php

示例9: removeAction

 /**
  * Remove a notification
  *
  * @param integer $id
  *
  * @return JsonResponse
  */
 public function removeAction($id)
 {
     $user = $this->userContext->getUser();
     if (null !== $user) {
         $this->manager->remove($user, $id);
     }
     return new JsonResponse();
 }
开发者ID:ashutosh-srijan,项目名称:findit_akeneo,代码行数:15,代码来源:NotificationController.php

示例10: findTranslatedLabels

 /**
  * {@inheritdoc}
  */
 public function findTranslatedLabels(array $options = [])
 {
     $query = $this->createQueryBuilder('f')->select('f.id')->addSelect('COALESCE(NULLIF(ft.label, \'\'), CONCAT(\'[\', f.code, \']\')) as label')->leftJoin('f.translations', 'ft', 'WITH', 'ft.locale = :locale_code')->orderBy('label')->setParameter('locale_code', $this->userContext->getCurrentLocaleCode())->getQuery();
     $choices = [];
     foreach ($query->getArrayResult() as $family) {
         $choices[$family['id']] = $family['label'];
     }
     return $choices;
 }
开发者ID:a2xchip,项目名称:pim-community-dev,代码行数:12,代码来源:FamilyRepository.php

示例11: finishView

 /**
  * {@inheritdoc}
  */
 public function finishView(FormView $view, FormInterface $form, array $options)
 {
     $values = null !== $view->vars['value'] ? $view->vars['value']->getValues() : [];
     $view->vars['groups'] = $this->productFormView->getView();
     $view->vars['orderedGroups'] = $this->getOrderedGroups($values);
     $view->vars['locales'] = $this->userContext->getUserLocales();
     $view->vars['channels'] = $this->channelManager->getChannels();
     $view->vars['currentLocale'] = $options['currentLocale'];
 }
开发者ID:abdeldayem,项目名称:pim-community-dev,代码行数:12,代码来源:ProductTemplateType.php

示例12: sequentialEditAction

 /**
  * Action for product sequential edition
  * @param Request $request
  *
  * @AclAncestor("pim_enrich_product_edit_attributes")
  * @return RedirectResponse
  */
 public function sequentialEditAction(Request $request)
 {
     $sequentialEdit = $this->seqEditManager->createEntity($this->getObjects($request), $this->userContext->getUser());
     if ($this->seqEditManager->findByUser($this->userContext->getUser())) {
         return new RedirectResponse($this->router->generate('pim_enrich_product_index', ['dataLocale' => $request->get('dataLocale')]));
     }
     $this->seqEditManager->save($sequentialEdit);
     return new RedirectResponse($this->router->generate('pim_enrich_product_edit', ['dataLocale' => $request->get('dataLocale'), 'id' => current($sequentialEdit->getObjectSet())]));
 }
开发者ID:ashutosh-srijan,项目名称:findit_akeneo,代码行数:16,代码来源:SequentialEditController.php

示例13: listTreeAction

 /**
  * List category trees. The select_node_id request parameter
  * allow to send back the tree where the node belongs with a selected
  * attribute
  *
  * @param Request $request
  *
  * @return array
  *
  * @Template
  * @AclAncestor("pim_enrich_category_list")
  */
 public function listTreeAction(Request $request)
 {
     $selectNodeId = $request->get('select_node_id', -1);
     try {
         $selectNode = $this->findCategory($selectNodeId);
     } catch (NotFoundHttpException $e) {
         $selectNode = $this->userContext->getUserTree();
     }
     return array('trees' => $this->categoryManager->getTrees(), 'selectedTreeId' => $selectNode->isRoot() ? $selectNode->getId() : $selectNode->getRoot(), 'include_sub' => (bool) $this->getRequest()->get('include_sub', false), 'product_count' => (bool) $this->getRequest()->get('with_products_count', true), 'related_entity' => $this->getRequest()->get('related_entity', 'product'));
 }
开发者ID:javiersantos,项目名称:pim-community-dev,代码行数:22,代码来源:CategoryTreeController.php

示例14: getAction

 /**
  * Get completeness for a product
  *
  * @param int $id
  *
  * @return JSONResponse
  */
 public function getAction($id)
 {
     $product = $this->productRepository->getFullProduct($id);
     $this->completenessManager->generateMissingForProduct($product);
     $channels = $this->channelRepository->getFullChannels();
     $locales = $this->userContext->getUserLocales();
     $filteredLocales = $this->collectionFilter->filterCollection($locales, 'pim.internal_api.locale.view');
     $completenesses = $this->completenessManager->getProductCompleteness($product, $channels, $filteredLocales, $this->userContext->getCurrentLocale()->getCode());
     return new JsonResponse($this->completenessNormalizer->normalize($completenesses, 'internal_api'));
 }
开发者ID:jacko972,项目名称:pim-community-dev,代码行数:17,代码来源:CompletenessController.php

示例15: getMetadata

 /**
  * {@inheritdoc}
  */
 public function getMetadata()
 {
     $metadata = parent::getMetadata();
     $defaultScope = $this->userContext->getUserChannel();
     $metadata['populateDefault'] = true;
     $metadata['placeholder'] = $defaultScope->getLabel();
     $metadata['choices'] = array_filter($metadata['choices'], function ($choice) use($defaultScope) {
         return $choice['value'] !== $defaultScope->getCode();
     });
     return $metadata;
 }
开发者ID:ashutosh-srijan,项目名称:findit_akeneo,代码行数:14,代码来源:ScopeFilter.php


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