PHP Класс Smile\ElasticsuiteCatalog\Helper\Attribute

Автор: Aurelien FOUCRET ([email protected])
Наследование: extends Smile\ElasticsuiteCore\Helper\Mapping
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
__construct ( Magento\Framework\App\Helper\Context $context, Magento\Framework\ObjectManagerInterface $objectManager, Magento\Catalog\Model\ResourceModel\Eav\AttributeFactory $attributeFactory, string $collectionFactory )
getAttributeCollection ( ) : Magento\Catalog\Model\ResourceModel\Product\Attribute\Collection Retrieve a new product attribute collection.
getFieldType ( Magento\Eav\Model\Entity\Attribute\AttributeInterface $attribute ) : string Get mapping field type for an attribute.
getIndexOptionText ( Magento\Eav\Model\Entity\Attribute\AttributeInterface $attribute, integer $storeId, string | integer $optionId ) : string | boolean Transform an options id into an array of option value for attribute that uses a source.
getIndexOptionsText ( Magento\Eav\Model\Entity\Attribute\AttributeInterface $attribute, integer $storeId, array $optionIds ) : array Transform an array of options ids into an arrays of option values for attribute that uses a source.
getMappingFieldOptions ( Magento\Eav\Model\Entity\Attribute\AttributeInterface $attribute ) : array Parse attribute to get mapping field creation parameters.
prepareIndexValue ( Magento\Eav\Model\Entity\Attribute\AttributeInterface $attribute, integer $storeId, mixed $value ) : array Parse attribute raw value (as saved in the database) to prepare the indexed value.

Приватные методы

Метод Описание
getAttributeByStore ( Magento\Eav\Model\Entity\Attribute\AttributeInterface | integer $attribute, integer $storeId ) : Magento\Catalog\Api\Data\EavAttributeInterface Load the localized version of an attribute.
getAttributeId ( Magento\Eav\Model\Entity\Attribute\AttributeInterface | integer $attribute ) : integer This util method is used to ensure the attribute is an integer and uses it's id if it is an object.
prepareSimpleIndexAttributeValue ( Magento\Eav\Model\Entity\Attribute\AttributeInterface $attribute, mixed $value ) : mixed Ensure types of numerical values is correct before indexing.

Описание методов

__construct() публичный метод

public __construct ( Magento\Framework\App\Helper\Context $context, Magento\Framework\ObjectManagerInterface $objectManager, Magento\Catalog\Model\ResourceModel\Eav\AttributeFactory $attributeFactory, string $collectionFactory )
$context Magento\Framework\App\Helper\Context Helper context.
$objectManager Magento\Framework\ObjectManagerInterface The object manager
$attributeFactory Magento\Catalog\Model\ResourceModel\Eav\AttributeFactory Factory used to create attributes.
$collectionFactory string Factory class name to use for create attribute collections.

getAttributeCollection() публичный метод

Retrieve a new product attribute collection.
public getAttributeCollection ( ) : Magento\Catalog\Model\ResourceModel\Product\Attribute\Collection
Результат Magento\Catalog\Model\ResourceModel\Product\Attribute\Collection

getFieldType() публичный метод

Get mapping field type for an attribute.
public getFieldType ( Magento\Eav\Model\Entity\Attribute\AttributeInterface $attribute ) : string
$attribute Magento\Eav\Model\Entity\Attribute\AttributeInterface Product attribute.
Результат string

getIndexOptionText() публичный метод

Value islocalized for a store id.
public getIndexOptionText ( Magento\Eav\Model\Entity\Attribute\AttributeInterface $attribute, integer $storeId, string | integer $optionId ) : string | boolean
$attribute Magento\Eav\Model\Entity\Attribute\AttributeInterface Product attribute.
$storeId integer Store id.
$optionId string | integer Option id.
Результат string | boolean

getIndexOptionsText() публичный метод

Values are localized for a store id.
public getIndexOptionsText ( Magento\Eav\Model\Entity\Attribute\AttributeInterface $attribute, integer $storeId, array $optionIds ) : array
$attribute Magento\Eav\Model\Entity\Attribute\AttributeInterface Product attribute.
$storeId integer Store id
$optionIds array Array of options ids.
Результат array

getMappingFieldOptions() публичный метод

Parse attribute to get mapping field creation parameters.
public getMappingFieldOptions ( Magento\Eav\Model\Entity\Attribute\AttributeInterface $attribute ) : array
$attribute Magento\Eav\Model\Entity\Attribute\AttributeInterface Product attribute.
Результат array

prepareIndexValue() публичный метод

For attribute using options the option value is also added to the result which contains two keys : - one is "attribute_code" and contained the option id(s) - the other one is "option_text_attribute_code" and contained option value(s) All value are transformed into arays to have a more simple management of multivalued attributes merging on composite products). ES doesn't care of having array of int when it an int is required.
public prepareIndexValue ( Magento\Eav\Model\Entity\Attribute\AttributeInterface $attribute, integer $storeId, mixed $value ) : array
$attribute Magento\Eav\Model\Entity\Attribute\AttributeInterface Product attribute.
$storeId integer Store id.
$value mixed Raw value to be parsed.
Результат array