public function getAttributeCollection()
    {
        if ($this->attributeCollection === null) {
            $this->attributeCollection = $this->attributeCollectionFactory->create();
            $attributeNameMapping      = array_flip($this->fieldNameMapping);

            $arrayNameCb = function (FieldInterface $field) use ($attributeNameMapping) {
                $attributeName = $field->getName();

                if (isset($attributeNameMapping[$attributeName])) {
                    $attributeName = $attributeNameMapping[$attributeName];
                }

                return $attributeName;
            };

            $fieldNames = array_map($arrayNameCb, $this->getMapping()->getFields());

            $this->attributeCollection->addFieldToFilter('attribute_code', $fieldNames)
                 ->addFieldToFilter('backend_type', ['neq' => 'datetime']);
        }

        return $this->attributeCollection;
    }
public function getAttributeCollection()
    {
        if ($this->attributeCollection === null) {
            $this->attributeCollection = $this->attributeCollectionFactory->create();
            $attributeNameMapping      = array_flip($this->fieldNameMapping);

            $arrayNameCb = function (FieldInterface $field) use ($attributeNameMapping) {
                $attributeName = $field->getName();

                if (isset($attributeNameMapping[$attributeName])) {
                    $attributeName = $attributeNameMapping[$attributeName];
                }

                return $attributeName;
            };

            $fieldNames = array_map($arrayNameCb, $this->getMapping()->getFields());

            $this->attributeCollection->addFieldToFilter('attribute_code', $fieldNames)
                 ->addFieldToFilter('backend_type', ['neq' => 'datetime']);
        }

        return $this->attributeCollection;
    }
public function getAttributeCollection ( ) { if ( $ this -> attributeCollection === null ) { $ this -> attributeCollection = $ this -> attributeCollectionFactory -> create ( ) ; $ attributeNameMapping = array_flip ( $ this -> fieldNameMapping ) ; $ arrayNameCb = function ( FieldInterface $ field ) use ( $ attributeNameMapping ) { $ attributeName = $ field -> getName ( ) ; if ( isset ( $ attributeNameMapping [ $ attributeName ] ) ) { $ attributeName = $ attributeNameMapping [ $ attributeName ] ; } return $ attributeName ; } ; $ fieldNames = array_map ( $ arrayNameCb , $ this -> getMapping ( ) -> getFields ( ) ) ; $ this -> attributeCollection -> addFieldToFilter ( 'attribute_code' , $ fieldNames ) -> addFieldToFilter ( 'backend_type' , [ 'neq' => 'datetime' ] ) ; } return $ this -> attributeCollection ; }
Retrieve attribute collection prefiltered with only attribute usable in rules.

@return \Magento\Catalog\Model\ResourceModel\Product\Attribute\Collection
Retrieve attribute collection prefiltered with only attribute usable in rules .