Magento2: Eav atrribute magento2 equivalent
-
11-12-2020 - |
Вопрос
What is the equivalent Magento 1 :
$tmp = new Mage_Catalog_Model_Resource_Eav_Attribute();
in Magento 2?
Решение
\Magento\Catalog\Model\ResourceModel\Eav\Attribute
this class is equivalent to Magento2
use Magento\Catalog\Model\ResourceModel\Eav\Attribute;
/**
* @var attribute
*/
protected $attribute;
/**
* @param attribute $attribute
*/
public function __construct(
Attribute $attribute,
) {
$this->$attribute = $attribute;
}
Now you can use this like,
$this->$attribute->isAllowedForRuleCondition()
// it depends on your need which method you want use
Не связан с magento.stackexchange