Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AttributeProvider.php
Go to the documentation of this file.
1 <?php
7 namespace Magento\Eav\Model;
8 
13 
18 {
22  protected $metadataPool;
23 
28 
33 
41  public function __construct(
45  ) {
46  $this->metadataPool = $metadataPool;
47  $this->attributeRepository = $attributeRepository;
48  $this->searchCriteriaBuilder = $searchCriteriaBuilder;
49  }
50 
58  public function getAttributes($entityType)
59  {
60  $metadata = $this->metadataPool->getMetadata($entityType);
61  $searchResult = $this->attributeRepository->getList(
62  $metadata->getEavEntityType(),
63  $this->searchCriteriaBuilder->addFilter('attribute_set_id', null, 'neq')->create()
64  );
65  $attributes = [];
66  foreach ($searchResult->getItems() as $attribute) {
67  $attributes[] = $attribute->getAttributeCode();
68  }
69  return $attributes;
70  }
71 }
__construct(MetadataPool $metadataPool, AttributeRepositoryInterface $attributeRepository, SearchCriteriaBuilder $searchCriteriaBuilder)
$attributes
Definition: matrix.phtml:13