/**
  * Returns array of fields
  *
  * @param string $entityType
  * @return array
  * @throws \Exception
  */
 public function getAttributes($entityType)
 {
     $metadata = $this->metadataPool->getMetadata($entityType);
     $searchResult = $this->attributeRepository->getList($metadata->getEavEntityType(), $this->searchCriteriaBuilder->create());
     $attributes = [];
     foreach ($searchResult->getItems() as $attribute) {
         $attributes[] = $attribute->getAttributeCode();
     }
     return $attributes;
 }
Esempio n. 2
0
 /**
  * @param string $entityType
  * @return \Magento\Eav\Api\Data\AttributeInterface[]
  * @throws \Exception
  */
 protected function getAttributes($entityType)
 {
     $attributes = $this->attributeCache->getAttributes($entityType);
     if ($attributes) {
         return $attributes;
     }
     $metadata = $this->metadataPool->getMetadata($entityType);
     $searchResult = $this->attributeRepository->getList($metadata->getEavEntityType(), $this->searchCriteriaBuilder->create());
     $attributes = $searchResult->getItems();
     $this->attributeCache->saveAttributes($entityType, $attributes);
     return $attributes;
 }
 /**
  * Get custom attributes
  *
  * @param string $entityType
  * @return \Magento\Eav\Api\Data\AttributeInterface[]
  * @throws \Exception
  */
 private function getNonStaticAttributes($entityType)
 {
     if (!isset($this->attributes[$entityType])) {
         $metadata = $this->metadataPool->getMetadata($entityType);
         $searchResult = $this->attributeRepository->getList($metadata->getEavEntityType(), $this->searchCriteriaBuilder->addFilter('attribute_set_id', null, 'neq')->create());
         $attributes = [];
         foreach ($searchResult->getItems() as $attribute) {
             if (!$attribute->isStatic()) {
                 $attributes[] = $attribute;
             }
         }
         $this->attributes[$entityType] = $attributes;
     }
     return $this->attributes[$entityType];
 }
 /**
  * @param string $entityType
  * @return \Magento\Eav\Api\Data\AttributeInterface[]
  */
 private function getAttributes($entityType)
 {
     $metadata = $this->metadataPool->getMetadata($entityType);
     $searchResult = $this->attributeRepository->getList($metadata->getEavEntityType(), $this->searchCriteriaBuilder->addFilters([$this->filterBuilder->setField('is_global')->setConditionType('in')->setValue([ScopedAttributeInterface::SCOPE_STORE, ScopedAttributeInterface::SCOPE_WEBSITE])->create()])->create());
     return $searchResult->getItems();
 }
Esempio n. 5
0
 /**
  * @param string $entityType
  * @return \Magento\Eav\Api\Data\AttributeInterface[]
  * @throws \Exception
  */
 protected function getAttributes($entityType)
 {
     $metadata = $this->metadataPool->getMetadata($entityType);
     $searchResult = $this->attributeRepository->getList($metadata->getEavEntityType(), $this->searchCriteriaBuilder->addFilter('attribute_set_id', null, 'neq')->create());
     return $searchResult->getItems();
 }
 /**
  * {@inheritdoc}
  */
 public function getList(\Magento\Framework\Api\SearchCriteriaInterface $searchCriteria)
 {
     return $this->eavAttributeRepository->getList(\Magento\Catalog\Api\Data\CategoryAttributeInterface::ENTITY_TYPE_CODE, $searchCriteria);
 }