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:


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


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?


For further reference, this was answered on stackoverflow: