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


PHP Manager\ChannelManager类代码示例

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


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

示例1: let

 function let(DocumentManager $manager, ChannelInterface $ecommerce, ChannelInterface $mobile, LocaleInterface $enUs, LocaleInterface $frFr, CategoryInterface $category, ChannelManager $channelManager, CategoryRepositoryInterface $categoryRepository, ProductRepository $productRepository, QueryBuilder $ormQb, Builder $odmQb, Query $odmQuery, Cursor $cursor)
 {
     $enUs->getCode()->willReturn('en_US');
     $frFr->getCode()->willReturn('fr_FR');
     $ecommerce->getCode()->willReturn('ecommerce');
     $ecommerce->getLabel()->willReturn('ECommerce');
     $ecommerce->getLocales()->willReturn(array($enUs, $frFr));
     $ecommerce->getCategory()->willReturn($category);
     $mobile->getCode()->willReturn('mobile');
     $mobile->getLabel()->willReturn('Mobile');
     $mobile->getLocales()->willReturn(array($enUs));
     $mobile->getCategory()->willReturn($category);
     $odmQuery->execute()->willReturn($cursor);
     $productRepository->createQueryBuilder()->willReturn($odmQb);
     $odmQb->hydrate(Argument::any())->willReturn($odmQb);
     $odmQb->field(Argument::any())->willReturn($odmQb);
     $odmQb->in(Argument::any())->willReturn($odmQb);
     $odmQb->equals(Argument::any())->willReturn($odmQb);
     $odmQb->select('_id')->willReturn($odmQb);
     $odmQb->getQuery()->willReturn($odmQuery);
     $categoryRepository->getAllChildrenQueryBuilder($category, true)->willReturn($ormQb);
     $categoryRepository->getCategoryIds($category, $ormQb)->willReturn(array(1, 2, 3));
     $channelManager->getFullChannels()->willReturn(array($ecommerce, $mobile));
     $manager->getRepository('pim_product_class')->willReturn($productRepository);
     $this->beConstructedWith($manager, $channelManager, $categoryRepository, 'pim_product_class');
 }
开发者ID:abdeldayem,项目名称:pim-community-dev,代码行数:26,代码来源:CompletenessRepositorySpec.php

示例2:

 function it_returns_flat_data_without_media(ChannelInterface $channel, ChannelManager $channelManager, ProductInterface $product, Serializer $serializer)
 {
     $product->getValues()->willReturn([]);
     $serializer->normalize($product, 'flat', ['scopeCode' => 'foobar', 'localeCodes' => ''])->willReturn(['normalized_product']);
     $channelManager->getChannelByCode('foobar')->willReturn($channel);
     $this->setChannel('foobar');
     $this->process($product)->shouldReturn(['media' => [], 'product' => ['normalized_product']]);
 }
开发者ID:umpirsky,项目名称:pim-community-dev,代码行数:8,代码来源:ProductToFlatArrayProcessorSpec.php

示例3:

 function it_throws_an_exception_if_no_file_is_found(ChannelInterface $channel, ProductInterface $product, ChannelManager $channelManager, Serializer $serializer, ProductValueInterface $productValue, AttributeInterface $attribute)
 {
     $product->getValues()->willReturn([$productValue]);
     $productValue->getAttribute()->willReturn($attribute);
     $attribute->getAttributeType()->willReturn('pim_catalog_image');
     $product->getIdentifier()->willReturn($productValue);
     $productValue->getData()->willReturn('data');
     $this->setChannel('foobar');
     $channelManager->getChannelByCode('foobar')->willReturn($channel);
     $serializer->normalize(['data'], 'flat', ['field_name' => 'media', 'prepare_copy' => true])->willThrow('Symfony\\Component\\HttpFoundation\\File\\Exception\\FileNotFoundException');
     $this->shouldThrow('Akeneo\\Bundle\\BatchBundle\\Item\\InvalidItemException')->during('process', [$product]);
 }
开发者ID:ashutosh-srijan,项目名称:findit_akeneo,代码行数:12,代码来源:ProductToFlatArrayProcessorSpec.php

示例4: ArrayCollection

 function it_returns_flat_data_without_media($productBuilder, ChannelInterface $channel, LocaleInterface $locale, ChannelManager $channelManager, ProductInterface $product, Serializer $serializer)
 {
     $localeCodes = ['en_US'];
     $channel->getLocales()->willReturn(new ArrayCollection([$locale]));
     $channel->getLocaleCodes()->willReturn($localeCodes);
     $productBuilder->addMissingProductValues($product, [$channel], [$locale])->shouldBeCalled();
     $product->getValues()->willReturn([]);
     $this->setDecimalSeparator(',');
     $serializer->normalize($product, 'flat', ['scopeCode' => 'foobar', 'localeCodes' => $localeCodes, 'decimal_separator' => ',', 'date_format' => 'yyyy-MM-dd'])->willReturn(['normalized_product']);
     $channelManager->getChannelByCode('foobar')->willReturn($channel);
     $this->setChannel('foobar');
     $this->process($product)->shouldReturn(['media' => [], 'product' => ['normalized_product']]);
 }
开发者ID:abdeldayem,项目名称:pim-community-dev,代码行数:13,代码来源:ProductToFlatArrayProcessorSpec.php

示例5: let

 function let(SecurityContextInterface $securityContext, LocaleManager $localeManager, ChannelManager $channelManager, CategoryManager $categoryManager, TokenInterface $token, User $user, LocaleInterface $en, LocaleInterface $fr, LocaleInterface $de, ChannelInterface $ecommerce, ChannelInterface $mobile, CategoryInterface $firstTree, CategoryInterface $secondTree)
 {
     $securityContext->getToken()->willReturn($token);
     $token->getUser()->willReturn($user);
     $en->getCode()->willReturn('en_US');
     $fr->getCode()->willReturn('fr_FR');
     $de->getCode()->willReturn('de_DE');
     $en->isActivated()->willReturn(true);
     $fr->isActivated()->willReturn(true);
     $de->isActivated()->willReturn(true);
     $localeManager->getLocaleByCode('en_US')->willReturn($en);
     $localeManager->getLocaleByCode('fr_FR')->willReturn($fr);
     $localeManager->getLocaleByCode('de_DE')->willReturn($de);
     $localeManager->getActiveLocales()->willReturn([$en, $fr, $de]);
     $channelManager->getChannels()->willReturn([$mobile, $ecommerce]);
     $categoryManager->getTrees()->willReturn([$firstTree, $secondTree]);
     $this->beConstructedWith($securityContext, $localeManager, $channelManager, $categoryManager, 'en_US');
 }
开发者ID:jacko972,项目名称:pim-community-dev,代码行数:18,代码来源:UserContextSpec.php

示例6:

 function it_returns_flat_data_without_media($productBuilder, ChannelInterface $channel, ChannelManager $channelManager, ProductInterface $product, Serializer $serializer)
 {
     $productBuilder->addMissingProductValues($product)->shouldBeCalled();
     $this->setLocale('en_US');
     $product->getValues()->willReturn([]);
     $serializer->normalize($product, 'flat', ['scopeCode' => 'mobile', 'localeCodes' => '', 'locale' => 'en_US'])->willReturn(['normalized_product']);
     $channelManager->getChannelByCode('mobile')->willReturn($channel);
     $this->setChannelCode('mobile');
     $this->process($product)->shouldReturn(['media' => [], 'product' => ['normalized_product']]);
 }
开发者ID:abdeldayem,项目名称:pim-community-dev,代码行数:10,代码来源:ProductToFlatArrayProcessorSpec.php

示例7: getPimLocales

 /**
  * Get all Pim locales for the given channel.
  *
  * @param string $channel
  *
  * @return array
  */
 protected function getPimLocales($channel)
 {
     if (!$this->pimLocales) {
         $this->pimLocales = $this->channelManager->getChannelByCode($channel)->getLocales();
     }
     return $this->pimLocales;
 }
开发者ID:rskonieczka,项目名称:MagentoConnectorBundle,代码行数:14,代码来源:AbstractNormalizer.php

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

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

示例10: validate

 /**
  * {@inheritdoc}
  */
 public function validate($value, Constraint $constraint)
 {
     $channels = $this->manager->getChannelChoices();
     if (0 === count($channels)) {
         throw new ConstraintDefinitionException('No channel is set in the application');
     }
     $constraint->choices = array_keys($channels);
     parent::validate($value, $constraint);
 }
开发者ID:ashutosh-srijan,项目名称:findit_akeneo,代码行数:12,代码来源:ChannelValidator.php

示例11: addFieldFilter

 /**
  * {@inheritdoc}
  */
 public function addFieldFilter($field, $operator, $value, $locale = null, $scope = null, $options = [])
 {
     $this->checkValue($field, $value, $locale, $scope);
     $channel = $this->channelManager->getChannelByCode($scope);
     foreach ($channel->getLocales() as $locale) {
         $field = sprintf("%s.%s.%s-%s", ProductQueryUtility::NORMALIZED_FIELD, 'completenesses', $scope, $locale);
         $value = intval($value);
         $this->qb->addOr($this->getExpr($value, $field, $operator));
     }
     return $this;
 }
开发者ID:techpub,项目名称:EnhancedConnectorBundle,代码行数:14,代码来源:CompletenessFilter.php

示例12: validate

 /**
  * Checks if the passed value is valid.
  *
  * @param AbstractProductProcessor $value      The value that should be validated
  * @param Constraint               $constraint The constraint for the validation
  *
  * @api
  */
 public function validate($value, Constraint $constraint)
 {
     if (!$value instanceof AbstractProductProcessor) {
         return null;
     }
     if ($channel = $this->channelManager->getChannelByCode($value->getChannel())) {
         foreach ($channel->getLocales() as $locale) {
             if ($locale->getCode() === $value->getDefaultLocale()) {
                 return null;
             }
         }
     }
     $this->context->addViolationAt('defaultLocale', $constraint->message, ['defaultLocale']);
 }
开发者ID:mejdoubimeriem,项目名称:prestashopconnector,代码行数:22,代码来源:HasValidDefaultLocaleValidator.php

示例13: validate

 /**
  * Checks if the passed value is valid.
  *
  * @param mixed      $value      The value that should be validated
  * @param Constraint $constraint The constraint for the validation
  *
  * @api
  * @return null
  */
 public function validate($value, Constraint $constraint)
 {
     if (!$value instanceof AbstractProductProcessor) {
         return null;
     }
     if ($channel = $this->channelManager->getChannelByCode($value->getChannel())) {
         foreach ($channel->getCurrencies() as $currency) {
             if ($currency->getCode() === $value->getCurrency()) {
                 return null;
             }
         }
     }
     $this->context->addViolationAt('currency', $constraint->message, ['currency']);
 }
开发者ID:jarocks,项目名称:MagentoConnectorBundle,代码行数:23,代码来源:HasValidCurrencyValidator.php

示例14: editAction

 /**
  * Edit a family
  *
  * TODO : find a way to use param converter with interfaces
  *
  * @param Family $family
  *
  * @Template
  * @AclAncestor("pim_enrich_family_index")
  *
  * @return array
  */
 public function editAction(Family $family)
 {
     if ($this->familyHandler->process($family)) {
         $this->addFlash('success', 'flash.family.updated');
     }
     return ['form' => $this->familyForm->createView(), 'attributesForm' => $this->getAvailableAttributesForm($family->getAttributes()->toArray())->createView(), 'channels' => $this->channelManager->getChannels()];
 }
开发者ID:noglitchyo,项目名称:pim-community-dev,代码行数:19,代码来源:FamilyController.php

示例15: getChannelChoicesWithUserChannel

 /**
  * Get channel choices with user channel code first
  *
  * @return string[]
  */
 public function getChannelChoicesWithUserChannel()
 {
     $channelChoices = $this->channelManager->getChannelChoices();
     $userChannelCode = $this->getUserChannelCode();
     if (array_key_exists($userChannelCode, $channelChoices)) {
         return [$userChannelCode => $channelChoices[$userChannelCode]] + $channelChoices;
     }
     return $channelChoices;
 }
开发者ID:javiersantos,项目名称:pim-community-dev,代码行数:14,代码来源:UserContext.php


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