- /* @var $collection Collection */
- $collection = $this->_categoryFactory->create()->getCollection();
-
- $matchingNamesCollection = clone $collection;
- $escapedNamePart = $this->_resourceHelper->addLikeEscape(
- $namePart,
- ['position' => 'any']
- );
- $matchingNamesCollection->addAttributeToFilter(
- 'name',
- ['like' => $escapedNamePart]
- )->addAttributeToFilter(
- 'entity_id',
- ['neq' => \Magento\Catalog\Model\Category::TREE_ROOT_ID]
- )->addAttributeToSelect(
- 'path'
- )->setStoreId(
- $storeId
- );