Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Protected Attributes
AttributeProvider Class Reference
Inheritance diagram for AttributeProvider:
AttributeProviderInterface

Public Member Functions

 __construct (MetadataPool $metadataPool, AttributeRepositoryInterface $attributeRepository, SearchCriteriaBuilder $searchCriteriaBuilder)
 
 getAttributes ($entityType)
 

Protected Attributes

 $metadataPool
 
 $attributeRepository
 
 $searchCriteriaBuilder
 

Detailed Description

Class EntitySnapshot

Definition at line 17 of file AttributeProvider.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( MetadataPool  $metadataPool,
AttributeRepositoryInterface  $attributeRepository,
SearchCriteriaBuilder  $searchCriteriaBuilder 
)

AttributeProvider constructor.

Parameters
MetadataPool$metadataPool
AttributeRepositoryInterface$attributeRepository
SearchCriteriaBuilder$searchCriteriaBuilder

Definition at line 41 of file AttributeProvider.php.

45  {
46  $this->metadataPool = $metadataPool;
47  $this->attributeRepository = $attributeRepository;
48  $this->searchCriteriaBuilder = $searchCriteriaBuilder;
49  }

Member Function Documentation

◆ getAttributes()

getAttributes (   $entityType)

Returns array of fields

Parameters
string$entityType
Returns
array
Exceptions

Implements AttributeProviderInterface.

Definition at line 58 of file AttributeProvider.php.

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  }
$attributes
Definition: matrix.phtml:13

Field Documentation

◆ $attributeRepository

$attributeRepository
protected

Definition at line 27 of file AttributeProvider.php.

◆ $metadataPool

$metadataPool
protected

Definition at line 22 of file AttributeProvider.php.

◆ $searchCriteriaBuilder

$searchCriteriaBuilder
protected

Definition at line 32 of file AttributeProvider.php.


The documentation for this class was generated from the following file: