Indexing Symfony Entity Relationships?

Hi there!

I have a product entity, and each product is assigned to a category which is a separate category entity which is joined with a categoryId property in my product Entity. I have indexed all of the properties that I need such as name price etc, but I can’t get my categoryId to index correctly:

cid
cid2

When this it is indexed I get an array but not with the actual category Id or other information associated in that category:

categoryId

So my question is, what is the correct way of going about this so that the category my product is assigned to is indexed correctly?

Thanks

For further reference, this was answered on stackoverflow: https://stackoverflow.com/questions/46553382/symfony-algolia-search-engine-association-indexing/46559778#46559778