How i can get value of field which is located in catalog_eav_attributes table? Help please
Follow the following code.
<?php
namespace Jesadiya\AttributeId\Model;
use Magento\Catalog\Model\Product;
use Magento\Eav\Api\AttributeRepositoryInterface;
class GetAttribute implements DataPatchInterface
{
/**
* @var AttributeRepositoryInterface
*/
private $attributeRepository;
public function __construct(
AttributeRepositoryInterface $attributeRepository
) { $this->attributeRepository = $attributeRepository;
}
public function getAttributeId()
{
$attribute = $this->attributeRepository->get(Product::ENTITY, 'sku');
return $attribute->getAttributeId();
}
}