/** * @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; }
/** * {@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); }
/** * {@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); }