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
Related Tags
collection × 1716magento2 × 497
magento-1.9 × 352
product-collection × 217
product × 138
category × 117
filter × 116
database × 101
grid × 96
attributes × 88
magento-1 × 83
model × 76
magento-1.7 × 71
sql × 63
magento-2.1 × 54
product-attribute × 53
magento-1.8 × 51
module × 50
query × 47
customer × 46
orders × 43
sorting × 41
magento2.3 × 37
layered-navigation × 36
resource-model × 36