1

You can use the category collection factory for getting the category. public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Catalog\Model\ResourceModel\Category\CollectionFactory $categoryCollectionFactory ) { $this->_categoryCollectionFactory = $categoryCollectionFactory; ...


1

Magento strictly follows and recommends design patterns Collection Repository This implementation use to manipulate entity objects but not able to create new one. $repo = $this->myRepository(); $object = $repo->getById($myId); $object->setData('something', 'somethingDifferent'); $repo->save($object); Collection Factory This implementation use ...


Only top voted, non community-wiki answers of a minimum length are eligible