Pregunta

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

¿Fue útil?

Solución

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(...);
}
Licenciado bajo: CC-BY-SA con atribución
No afiliado a magento.stackexchange
scroll top