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


PHP AttributeInterface::getOptions方法代码示例

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


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

示例1: updateSorting

 /**
  * Update attribute option sorting
  *
  * @param AttributeInterface $attribute
  * @param array              $sorting
  */
 public function updateSorting(AttributeInterface $attribute, array $sorting = [])
 {
     foreach ($attribute->getOptions() as $option) {
         if (isset($sorting[$option->getId()])) {
             $option->setSortOrder($sorting[$option->getId()]);
         } else {
             $option->setSortOrder(0);
         }
     }
     $this->optionSaver->saveAll($attribute->getOptions()->toArray());
 }
开发者ID:a2xchip,项目名称:pim-community-dev,代码行数:17,代码来源:AttributeOptionsSorter.php

示例2: __construct

 /**
  * @param AttributeRepositoryInterface $attributeRepository
  * @param AttributeOptionRepositoryInterface $attributeOptionRepository
  * @param string $attributeCode
  * @param FileLoader $loader
  * @param string $mappingFile
  */
 public function __construct(AttributeRepositoryInterface $attributeRepository, AttributeOptionRepositoryInterface $attributeOptionRepository, $attributeCode, FileLoader $loader = null, $mappingFile = null)
 {
     $this->attributeRepository = $attributeRepository;
     $this->attributeOptionRepository = $attributeOptionRepository;
     $this->mapping = [];
     $this->attribute = $this->attributeRepository->findOneByIdentifier($attributeCode);
     if ($this->attribute) {
         $this->attributeOptions = $this->attribute->getOptions();
     } else {
         $this->attributeOptions = new ArrayCollection();
     }
     if ($mappingFile !== null && $loader !== null) {
         foreach ($loader->load($mappingFile) as $rawValue => $optionCode) {
             $this->mapTo($rawValue, $optionCode);
         }
     }
 }
开发者ID:lunistore,项目名称:akeneo-connector-base,代码行数:24,代码来源:AttributeOptionDiscoverer.php

示例3: normalizeOptions

 /**
  * {@inheritdoc}
  */
 protected function normalizeOptions(AttributeInterface $attribute)
 {
     $options = $attribute->getOptions();
     if ($options->isEmpty()) {
         $options = '';
     } else {
         $data = [];
         foreach ($options as $option) {
             $item = [];
             foreach ($option->getOptionValues() as $value) {
                 $label = str_replace('{locale}', $value->getLocale(), self::LOCALIZABLE_PATTERN);
                 $label = str_replace('{value}', $value->getValue(), $label);
                 $item[] = $label;
             }
             $data[] = 'Code:' . $option->getCode() . self::ITEM_SEPARATOR . implode(self::ITEM_SEPARATOR, $item);
         }
         $options = implode(self::GROUP_SEPARATOR, $data);
     }
     return $options;
 }
开发者ID:abdeldayem,项目名称:pim-community-dev,代码行数:23,代码来源:AttributeNormalizer.php

示例4: normalizeOptions

 /**
  * Normalize options
  *
  * @param AttributeInterface $attribute
  *
  * @return array
  */
 protected function normalizeOptions(AttributeInterface $attribute)
 {
     $data = [];
     $options = $attribute->getOptions();
     foreach ($options as $option) {
         $data[$option->getCode()] = [];
         foreach ($option->getOptionValues() as $value) {
             $data[$option->getCode()][$value->getLocale()] = $value->getValue();
         }
     }
     return $data;
 }
开发者ID:a2xchip,项目名称:pim-community-dev,代码行数:19,代码来源:AttributeNormalizer.php


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