Skip to content
Advertisement

Multidimensional array results with joins

I’m joining tables and I’d like to get multidimensional query results based on my joins.

JavaScript

As you can see Product is linked to a Package (many to one)

Here is the kind of result I’m getting:

JavaScript

Here is what I’d like to get:

JavaScript

Is there a way to hydrate this kind of multidimensional array with Doctrine 2 ?

I mean with Doctrine 2, not with “post prod” php loops

Advertisement

Answer

You need a combination of partial results with an array hydrator. Try:

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement