I am injecting this collection into my model:
\Magento\Reports\Model\ResourceModel\Product\Collection $prodCollection
I use it to create an array of all products but I want to add the products category ids to the results.
I tried:
$prodItems = $this->prodCollection->addFieldToSelect('*')->addCategoryIds()->getData();
This doesn't include the category IDs in results. I am trying to avoid having to load the product through the product repository and calling the method to get categories on every single product as that would be a very expensive operation.
Whats the cheapest way to get the product categories?