diff --git a/Model/CategoryListRepository.php b/Model/CategoryListRepository.php index 3f5a50f..a1e3c8d 100755 --- a/Model/CategoryListRepository.php +++ b/Model/CategoryListRepository.php @@ -4,8 +4,8 @@ use Magento\Catalog\Api\CategoryListInterface; use Magento\Framework\Api\SearchCriteriaBuilder; +use Magento\Framework\Api\SearchCriteriaInterface; use Magento\Framework\Api\FilterBuilder; -use Magento\Framework\Api\Search\FilterGroup; class CategoryListRepository { @@ -23,17 +23,8 @@ public function __construct( $this->filterBuilder = $filterBuilder; } - public function execute() + public function getList(SearchCriteriaInterface $searchCriteria) { - $entityIdFilter = $this->filterBuilder->setField('entity_id')->setValue(1)->setConditionType('gt')->create(); - $parentIdFilter = $this->filterBuilder->setField('parent_id')->setValue(1)->setConditionType('gt')->create(); - $isActiveFilter = $this->filterBuilder->setField('is_active')->setValue(1)->setConditionType('eq')->create(); - - $filterGroup = new FilterGroup(); - $filterGroup->setFilters([$entityIdFilter, $parentIdFilter, $isActiveFilter]); - - $searchCriteria = $this->searchCriteriaBuilder->setFilterGroups([$filterGroup])->create(); - $categories = $this->categoryRepository->getList($searchCriteria)->getItems(); $categoryData = [];