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


PHP AttributeRepositoryInterface::findAll方法代碼示例

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


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

示例1: resolveAttributeColumns

 /**
  * @return array
  */
 public function resolveAttributeColumns()
 {
     if (empty($this->attributesFields)) {
         // TODO: Put a Cursor to avoid a findAll on attributes (╯°□°)╯︵ ┻━┻
         $attributes = $this->attributeRepository->findAll();
         $currencyCodes = $this->currencyRepository->getActivatedCurrencyCodes();
         $values = $this->valuesResolver->resolveEligibleValues($attributes);
         foreach ($values as $value) {
             $field = $this->resolveFlatAttributeName($value['attribute'], $value['locale'], $value['scope']);
             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:a2xchip,項目名稱:pim-community-dev,代碼行數:29,代碼來源:AttributeColumnsResolver.php

示例2: dump

 /**
  * {@inheritdoc}
  */
 public function dump(OutputInterface $output, HelperSet $helperSet)
 {
     $output->writeln("<info>Useable attributes filters...</info>");
     $attributeFilters = $this->getAttributeFilters();
     $attributes = $this->repository->findAll();
     $rows = [];
     foreach ($attributes as $attribute) {
         $rows = array_merge($rows, $this->getFilterInformationForAttribute($attribute, $attributeFilters));
     }
     $table = $helperSet->get('table');
     $headers = ['attribute', 'localizable', 'scopable', 'attribute type', 'operators', 'filter_class'];
     $table->setHeaders($headers)->setRows($rows);
     $table->render($output);
 }
開發者ID:a2xchip,項目名稱:pim-community-dev,代碼行數:17,代碼來源:AttributeFilterDumper.php

示例3: 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:abdeldayem,項目名稱:pim-community-dev,代碼行數:25,代碼來源:AttributeFilterDumper.php


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