/** * {@inheritdoc} */ public function resolve(array $fields) { $resolvedFields = []; foreach ($fields as $field) { if ('*' === $field) { $resolvedFields = [$this->fieldFactory->create(['attributeId' => null, 'column' => 'data_index', 'type' => FieldInterface::TYPE_FULLTEXT])]; break; } $attribute = $this->attributeCollection->getItemByColumnValue('attribute_code', $field); $attributeId = $attribute ? $attribute->getId() : 0; $resolvedFields[$field] = $this->fieldFactory->create(['attributeId' => $attributeId, 'column' => 'data_index', 'type' => FieldInterface::TYPE_FULLTEXT]); } return $resolvedFields; }
/** * @param string $field * @return \Magento\Catalog\Model\ResourceModel\Eav\Attribute */ private function getAttributeByCode($field) { $attribute = $this->attributeCollection->getItemByColumnValue('attribute_code', $field); return $attribute; }