/** * Entity attributes collection getter. * * @return \Magento\Catalog\Model\ResourceModel\Product\Attribute\Collection */ public function getAttributeCollection() { return $this->_attributeColFactory->create(); }
/** * Attach Attributes By Id * * @param string $attributeSetName * @param array $attributeIds * @return void */ protected function attachAttributesById($attributeSetName, $attributeIds) { foreach ($this->_prodAttrColFac->create()->addFieldToFilter('main_table.attribute_id', ['in' => $attributeIds]) as $attribute) { $attributeCode = $attribute->getAttributeCode(); $attributeId = $attribute->getId(); if ($attribute->getIsVisible() || in_array($attributeCode, $this->_forcedAttributesCodes)) { self::$commonAttributesCache[$attributeId] = ['id' => $attributeId, 'code' => $attributeCode, 'is_global' => $attribute->getIsGlobal(), 'is_required' => $attribute->getIsRequired(), 'is_unique' => $attribute->getIsUnique(), 'frontend_label' => $attribute->getFrontendLabel(), 'is_static' => $attribute->isStatic(), 'apply_to' => $attribute->getApplyTo(), 'type' => \Magento\ImportExport\Model\Import::getAttributeType($attribute), 'default_value' => strlen($attribute->getDefaultValue()) ? $attribute->getDefaultValue() : null, 'options' => $this->_entityModel->getAttributeOptions($attribute, $this->_indexValueAttributes)]; self::$attributeCodeToId[$attributeCode] = $attributeId; $this->_addAttributeParams($attributeSetName, self::$commonAttributesCache[$attributeId], $attribute); } } }