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


PHP ChannelManager::getChannelByCode方法代码示例

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


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

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

示例2: getQuery

 /**
  * {@inheritdoc}
  */
 public function getQuery()
 {
     if (!$this->query) {
         $channel = $this->channelManager->getChannelByCode($this->channel);
         $this->query = $this->repository->findOrderedCategories($channel->getCategory())->getQuery();
     }
     return $this->query;
 }
开发者ID:rskonieczka,项目名称:MagentoConnectorBundle,代码行数:11,代码来源:CategoryReader.php

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

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

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

示例6: read

 /**
  * {@inheritdoc}
  */
 public function read()
 {
     $this->documentManager->clear();
     if (!$this->executed) {
         $this->executed = true;
         if (!is_object($this->channel)) {
             $this->channel = $this->channelManager->getChannelByCode($this->channel);
         }
         if ($this->missingCompleteness) {
             $this->completenessManager->generateMissingForChannel($this->channel);
         }
         $this->query = $this->repository->buildByChannelAndCompleteness($this->channel)->getQuery();
         $this->products = $this->getQuery()->execute();
         // MongoDB Cursor are not positioned on first element (whereas ArrayIterator is)
         // as long as getNext() hasn't be called
         $this->products->getNext();
     }
     $result = $this->products->current();
     if ($result) {
         $this->metricConverter->convert($result, $this->channel);
         $this->stepExecution->incrementSummaryInfo('read');
         $this->products->next();
     }
     return $result;
 }
开发者ID:javiersantos,项目名称:pim-community-dev,代码行数:28,代码来源:ODMProductReader.php

示例7:

 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

示例8: read

 /**
  * {@inheritdoc}
  */
 public function read()
 {
     if (!$this->query) {
         $code = $this->channel;
         if (!is_object($this->channel)) {
             $this->channel = $this->channelManager->getChannelByCode($this->channel);
         }
         if (!$this->channel) {
             throw new \InvalidArgumentException(sprintf('Could not find the channel "%s"', $code));
         }
         $this->completenessManager->generateMissingForChannel($this->channel);
         $this->query = $this->repository->buildByChannelAndCompleteness($this->channel)->getQuery();
     }
     $product = parent::read();
     if ($product) {
         $this->metricConverter->convert($product, $this->channel);
     }
     return $product;
 }
开发者ID:ashutosh-srijan,项目名称:findit_akeneo,代码行数:22,代码来源:ObsoleteProductReader.php

示例9:

 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

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

示例11: read

 /**
  * @{inheritdoc}
  */
 public function read()
 {
     $product = null;
     if ($this->products->valid()) {
         $product = $this->products->current();
         $this->stepExecution->incrementSummaryInfo('read');
         $this->products->next();
     }
     if (null !== $product) {
         $channel = $this->channelManager->getChannelByCode($this->channel);
         $this->metricConverter->convert($product, $channel);
     }
     return $product;
 }
开发者ID:axel-ducret,项目名称:EnhancedConnectorBundle,代码行数:17,代码来源:ProductReader.php

示例12: getIds

 /**
  * Get ids of products which are completes and in channel
  *
  * @return array
  */
 protected function getIds()
 {
     if (!is_object($this->channel)) {
         $this->channel = $this->channelManager->getChannelByCode($this->channel);
     }
     if ($this->missingCompleteness) {
         $this->completenessManager->generateMissingForChannel($this->channel);
     }
     $this->query = $this->DnDBuildByChannelAndCompleteness($this->channel, $this->getIsComplete());
     $rootAlias = current($this->query->getRootAliases());
     $rootIdExpr = sprintf('%s.id', $rootAlias);
     $from = current($this->query->getDQLPart('from'));
     $this->query->select($rootIdExpr)->resetDQLPart('from')->from($from->getFrom(), $from->getAlias(), $rootIdExpr)->andWhere($this->query->expr()->orX($this->query->expr()->gte($from->getAlias() . '.updated', ':updated')))->setParameter('updated', $this->getDateFilter())->setParameter('enabled', $this->getIsEnabled())->groupBy($rootIdExpr);
     $results = $this->query->getQuery()->getArrayResult();
     return array_keys($results);
 }
开发者ID:nocturnalfrog,项目名称:DnD-MagentoConnectorBundle,代码行数:21,代码来源:ORMProductReader.php

示例13: getIds

 /**
  * Get ids of products which are completes and in channel
  *
  * @return array
  */
 protected function getIds()
 {
     if (!is_object($this->channel)) {
         $this->channel = $this->channelManager->getChannelByCode($this->channel);
     }
     if ($this->missingCompleteness) {
         $this->completenessManager->generateMissingForChannel($this->channel);
     }
     $this->query = $this->repository->buildByChannelAndCompleteness($this->channel);
     $rootAlias = current($this->query->getRootAliases());
     $rootIdExpr = sprintf('%s.id', $rootAlias);
     $from = current($this->query->getDQLPart('from'));
     $this->query->select($rootIdExpr)->resetDQLPart('from')->from($from->getFrom(), $from->getAlias(), $rootIdExpr)->groupBy($rootIdExpr);
     $results = $this->query->getQuery()->getArrayResult();
     return array_keys($results);
 }
开发者ID:abdeldayem,项目名称:pim-community-dev,代码行数:21,代码来源:ORMProductReader.php

示例14:

 function it_returns_flat_data_without_media($dateformatProvider, $numberFormatProvider, ChannelInterface $channel, ChannelManager $channelManager, ProductInterface $product, Serializer $serializer)
 {
     $dateformatProvider->getFormat('en_US')->willReturn('n/j/y');
     $numberFormatProvider->getFormat('en_US')->willReturn(['decimal_separator' => '.']);
     $this->configureOptions('en_US');
     $product->getValues()->willReturn([]);
     $serializer->normalize($product, 'flat', ['scopeCode' => 'mobile', 'localeCodes' => '', 'decimal_separator' => '.', 'date_format' => 'n/j/y'])->willReturn(['normalized_product']);
     $channelManager->getChannelByCode('mobile')->willReturn($channel);
     $this->setChannelCode('mobile');
     $this->process($product)->shouldReturn(['media' => [], 'product' => ['normalized_product']]);
 }
开发者ID:qrz-io,项目名称:pim-community-dev,代码行数:11,代码来源:ProductToFlatArrayProcessorSpec.php

示例15: getLocaleCodes

 /**
  * Get locale codes for a channel
  *
  * @param string $channelCode
  *
  * @return array
  */
 protected function getLocaleCodes($channelCode)
 {
     $channel = $this->channelManager->getChannelByCode($channelCode);
     return $channel->getLocaleCodes();
 }
开发者ID:paulclarkin,项目名称:pim-community-dev,代码行数:12,代码来源:ProductToFlatArrayProcessor.php


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