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

许可以下: CC-BY-SA归因
scroll top