當前位置: 首頁>>代碼示例>>PHP>>正文


PHP UserContext::getCurrentLocale方法代碼示例

本文整理匯總了PHP中Pim\Bundle\UserBundle\Context\UserContext::getCurrentLocale方法的典型用法代碼示例。如果您正苦於以下問題:PHP UserContext::getCurrentLocale方法的具體用法?PHP UserContext::getCurrentLocale怎麽用?PHP UserContext::getCurrentLocale使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Pim\Bundle\UserBundle\Context\UserContext的用法示例。


在下文中一共展示了UserContext::getCurrentLocale方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

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

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

示例3: getLocale

 /**
  * @return LocaleInterface
  */
 public function getLocale()
 {
     if ($this->locale instanceof LocaleInterface) {
         return $this->locale;
     }
     return $this->userContext->getCurrentLocale();
 }
開發者ID:jacko972,項目名稱:pim-community-dev,代碼行數:10,代碼來源:EditCommonAttributes.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: let

 function let(UserContext $userContext, LocaleManager $localeManager, Locale $en)
 {
     $en->getCode()->willReturn('en_US');
     $userContext->getCurrentLocale()->willReturn($en);
     $this->beConstructedWith($userContext, $localeManager);
 }
開發者ID:javiersantos,項目名稱:pim-community-dev,代碼行數:6,代碼來源:LocaleHelperSpec.php

示例7: let

 function let(UserContext $userContext, LocaleRepositoryInterface $localeRepository, LocaleInterface $en)
 {
     $en->getCode()->willReturn('en_US');
     $userContext->getCurrentLocale()->willReturn($en);
     $this->beConstructedWith($userContext, $localeRepository);
 }
開發者ID:alexisfroger,項目名稱:pim-community-dev,代碼行數:6,代碼來源:LocaleHelperSpec.php

示例8: getDataLocale

 /**
  * Get data locale object
  *
  * @throws \Exception
  *
  * @return LocaleInterface
  */
 protected function getDataLocale()
 {
     return $this->userContext->getCurrentLocale();
 }
開發者ID:VinceBLOT,項目名稱:pim-community-dev,代碼行數:11,代碼來源:ProductController.php

示例9: getCurrentLocaleCode

 /**
  * Returns the current locale code
  *
  * @return string
  */
 public function getCurrentLocaleCode()
 {
     return $this->userContext->getCurrentLocale()->getCode();
 }
開發者ID:abdeldayem,項目名稱:pim-community-dev,代碼行數:9,代碼來源:LocaleHelper.php


注:本文中的Pim\Bundle\UserBundle\Context\UserContext::getCurrentLocale方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。