Question

What is the equivalent Magento 1 :

$tmp = new Mage_Catalog_Model_Resource_Eav_Attribute();

in Magento 2?

Was it helpful?

Solution

\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

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top