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

Public Member Functions

 __construct (\Magento\Eav\Model\Config $eavConfig, \Magento\Eav\Model\ResourceModel\Entity\Attribute $eavResource, \Magento\Eav\Model\ResourceModel\Entity\Attribute\CollectionFactory $attributeCollectionFactory, \Magento\Eav\Api\Data\AttributeSearchResultsInterfaceFactory $searchResultsFactory, \Magento\Eav\Model\Entity\AttributeFactory $attributeFactory, \Magento\Framework\Api\ExtensionAttribute\JoinProcessorInterface $joinProcessor, CollectionProcessorInterface $collectionProcessor=null)
 
 save (\Magento\Eav\Api\Data\AttributeInterface $attribute)
 
 delete (\Magento\Eav\Api\Data\AttributeInterface $attribute)
 
- Public Member Functions inherited from AttributeRepositoryInterface
 getList ($entityTypeCode, \Magento\Framework\Api\SearchCriteriaInterface $searchCriteria)
 
 get ($entityTypeCode, $attributeCode)
 
 save (\Magento\Eav\Api\Data\AttributeInterface $attribute)
 
 delete (Data\AttributeInterface $attribute)
 
 deleteById ($attributeId)
 

Protected Attributes

 $eavConfig
 
 $eavResource
 
 $attributeCollectionFactory
 
 $searchResultsFactory
 
 $attributeFactory
 
 $joinProcessor
 

Detailed Description

@SuppressWarnings(PHPMD.CouplingBetweenObjects)

Definition at line 18 of file AttributeRepository.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( \Magento\Eav\Model\Config  $eavConfig,
\Magento\Eav\Model\ResourceModel\Entity\Attribute  $eavResource,
\Magento\Eav\Model\ResourceModel\Entity\Attribute\CollectionFactory  $attributeCollectionFactory,
\Magento\Eav\Api\Data\AttributeSearchResultsInterfaceFactory  $searchResultsFactory,
\Magento\Eav\Model\Entity\AttributeFactory  $attributeFactory,
\Magento\Framework\Api\ExtensionAttribute\JoinProcessorInterface  $joinProcessor,
CollectionProcessorInterface  $collectionProcessor = null 
)
Parameters
Config$eavConfig
\Magento\Eav\Model\ResourceModel\Entity\Attribute$eavResource
\Magento\Eav\Model\ResourceModel\Entity\Attribute\CollectionFactory$attributeCollectionFactory
\Magento\Eav\Api\Data\AttributeSearchResultsInterfaceFactory$searchResultsFactory
Entity\AttributeFactory$attributeFactory
\Magento\Framework\Api\ExtensionAttribute\JoinProcessorInterface$joinProcessor
CollectionProcessorInterface$collectionProcessor@codeCoverageIgnore

Definition at line 65 of file AttributeRepository.php.

73  {
74  $this->eavConfig = $eavConfig;
75  $this->eavResource = $eavResource;
76  $this->attributeCollectionFactory = $attributeCollectionFactory;
77  $this->searchResultsFactory = $searchResultsFactory;
78  $this->attributeFactory = $attributeFactory;
79  $this->joinProcessor = $joinProcessor;
80  $this->collectionProcessor = $collectionProcessor ?: $this->getCollectionProcessor();
81  }

Member Function Documentation

◆ delete()

delete ( \Magento\Eav\Api\Data\AttributeInterface  $attribute)

{}

Definition at line 179 of file AttributeRepository.php.

180  {
181  try {
182  $this->eavResource->delete($attribute);
183  } catch (\Exception $e) {
184  throw new StateException(__("The attribute can't be deleted."));
185  }
186  return true;
187  }
__()
Definition: __.php:13

◆ save()

{}

Definition at line 86 of file AttributeRepository.php.

87  {
88  try {
89  $this->eavResource->save($attribute);
90  } catch (\Exception $e) {
91  throw new StateException(__("The attribute can't be saved."));
92  }
93  return $attribute;
94  }
__()
Definition: __.php:13

Field Documentation

◆ $attributeCollectionFactory

$attributeCollectionFactory
protected

Definition at line 33 of file AttributeRepository.php.

◆ $attributeFactory

$attributeFactory
protected

Definition at line 43 of file AttributeRepository.php.

◆ $eavConfig

$eavConfig
protected

Definition at line 23 of file AttributeRepository.php.

◆ $eavResource

$eavResource
protected

Definition at line 28 of file AttributeRepository.php.

◆ $joinProcessor

$joinProcessor
protected

Definition at line 48 of file AttributeRepository.php.

◆ $searchResultsFactory

$searchResultsFactory
protected

Definition at line 38 of file AttributeRepository.php.


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