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


PHP AttributeRepositoryInterface::findAll方法代码示例

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


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

示例1: resolveAttributeColumns

 /**
  * @return array
  */
 public function resolveAttributeColumns()
 {
     if (empty($this->attributesFields)) {
         $attributes = $this->attributeRepository->findAll();
         $currencyCodes = $this->currencyRepository->getActivatedCurrencyCodes();
         $values = $this->valuesResolver->resolveEligibleValues($attributes);
         foreach ($values as $value) {
             if (null !== $value['locale'] && null !== $value['scope']) {
                 $field = sprintf('%s-%s-%s', $value['attribute'], $value['locale'], $value['scope']);
             } elseif (null !== $value['locale']) {
                 $field = sprintf('%s-%s', $value['attribute'], $value['locale']);
             } elseif (null !== $value['scope']) {
                 $field = sprintf('%s-%s', $value['attribute'], $value['scope']);
             } else {
                 $field = $value['attribute'];
             }
             if (AttributeTypes::PRICE_COLLECTION === $value['type']) {
                 $this->attributesFields[] = $field;
                 foreach ($currencyCodes as $currencyCode) {
                     $currencyField = sprintf('%s-%s', $field, $currencyCode);
                     $this->attributesFields[] = $currencyField;
                 }
             } elseif (AttributeTypes::METRIC === $value['type']) {
                 $this->attributesFields[] = $field;
                 $metricField = sprintf('%s-%s', $field, 'unit');
                 $this->attributesFields[] = $metricField;
             } else {
                 $this->attributesFields[] = $field;
             }
         }
     }
     return $this->attributesFields;
 }
开发者ID:noglitchyo,项目名称:pim-community-dev,代码行数:36,代码来源:AttributeColumnsResolver.php

示例2: dump

 /**
  * {@inheritdoc}
  */
 public function dump(OutputInterface $output, HelperSet $helperSet)
 {
     $output->writeln("<info>Useable attributes filters...</info>");
     $attributes = $this->repository->findAll();
     $rows = [];
     foreach ($attributes as $attribute) {
         $field = $attribute->getCode();
         $filter = $this->registry->getAttributeFilter($attribute);
         if ($filter) {
             $class = get_class($filter);
             $operators = implode(', ', $filter->getOperators());
         } else {
             $class = 'Not supported';
             $operators = '';
         }
         $rows[] = [$field, $attribute->isLocalizable() ? 'yes' : 'no', $attribute->isScopable() ? 'yes' : 'no', $attribute->getAttributeType(), $class, $operators];
     }
     $table = $helperSet->get('table');
     $headers = ['attribute', 'localizable', 'scopable', 'attribute type', 'filter_class', 'operators'];
     $table->setHeaders($headers)->setRows($rows);
     $table->render($output);
 }
开发者ID:noglitchyo,项目名称:pim-community-dev,代码行数:25,代码来源:AttributeFilterDumper.php


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