In Magento 2, you're supposed to use the interfaces in Magento's API. So, when you want to fetch product(s), you'd use
\Magento\Catalog\Api\ProductRepositoryInterface. That works great and it's very convenient.
Now when I want to get a list of categories, based on my search criteria. What's the best way to approach this? I don't really see the options, because:
\Magento\Catalog\Api\CategoryRepositoryInterfaceonly supports a single entity, no
getList()or something like that.
\Magento\Catalog\Model\ResourceModel\Category\Collection\Factoryis used a lot from what I've seen from community code. However, this class is deprecated, which clearly means it shouldn't be used.
\Magento\Catalog\Model\CategoryFactoryis also used a lot. It's a dynamically generated factory. Developers would use this factory to create a category model and get it's collection. That seems really awful to me, but it's a way to go I guess..