0

It's been commonly accepted you should never use \Magento\Framework\App\ObjectManager::getInstance() I can link sources explaining why if needed. Given this how would I go about getting the names of my categories if I should never use \Magento\Framework\App\ObjectManager::getInstance()? Thanks.

EDIT: I don't just want category names I'd like IDs and various other bits of information for each but names is a good start

John
  • 827
  • 10
  • 22

1 Answers1

0

Read the comments to the original question if you need a solution to my problem

    public function __construct(
    ...
    \Magento\Catalog\Model\ResourceModel\Category\CollectionFactory $collecionFactory
) {
    $this->_collectionFactory = $collecionFactory;
    parent::__construct(...);
}
John
  • 827
  • 10
  • 22