13 use Magento\Eav\Model\Entity\Attribute\SetFactory as AttributeSetFactory;
15 use Magento\Eav\Model\ResourceModel\Entity\Attribute\Set\CollectionFactory;
29 private $attributeSetResource;
34 private $attributeSetFactory;
39 private $collectionFactory;
49 private $searchResultsFactory;
59 private $collectionProcessor;
73 AttributeSetFactory $attributeSetFactory,
74 CollectionFactory $collectionFactory,
76 \
Magento\Eav\Api\Data\AttributeSetSearchResultsInterfaceFactory $searchResultFactory,
80 $this->attributeSetResource = $attributeSetResource;
82 $this->collectionFactory = $collectionFactory;
84 $this->searchResultsFactory = $searchResultFactory;
86 $this->collectionProcessor = $collectionProcessor ?: $this->getCollectionProcessor();
96 }
catch (\Exception $exception) {
99 'The attribute set couldn\'t be saved due to an error. ' 100 .
'Verify your information and try again. If the error persists, please try again later.' 119 $searchResults = $this->searchResultsFactory->create();
122 $searchResults->setTotalCount(
$collection->getSize());
123 return $searchResults;
136 foreach ($filterGroup->getFilters() as $filter) {
137 if ($filter->getField() ==
'entity_type_code') {
138 return $filter->getValue();
169 }
catch (\Exception $exception) {
172 'The attribute set couldn\'t be deleted due to an error. ' 173 .
'Try again — if the error persists, please try again later.' 194 private function getCollectionProcessor()
196 if (!$this->collectionProcessor) {
198 'Magento\Eav\Model\Api\SearchCriteria\AttributeSetCollectionProcessor' 201 return $this->collectionProcessor;
getEntityTypeCode(\Magento\Framework\Api\SearchCriteriaInterface $searchCriteria)
getList(\Magento\Framework\Api\SearchCriteriaInterface $searchCriteria)
__construct(AttributeSetResource $attributeSetResource, AttributeSetFactory $attributeSetFactory, CollectionFactory $collectionFactory, EavConfig $eavConfig, \Magento\Eav\Api\Data\AttributeSetSearchResultsInterfaceFactory $searchResultFactory, \Magento\Framework\Api\ExtensionAttribute\JoinProcessorInterface $joinProcessor, CollectionProcessorInterface $collectionProcessor=null)
static singleField($fieldName, $fieldValue)
deleteById($attributeSetId)
save(AttributeSetInterface $attributeSet)