Hey,
I have this simple schema:
Model\Effect has a referencesMany of Model\Category ('categories' keyword in the config Classes).
$effects = $mandango->getRepository('Model\Effect')->createQuery()->references(array('categories'));
foreach ($effects as $effect) {
foreach ($effect->getCategories()->createQuery() as $category) {
echo $category->getName();
}
}
I have a logger, and what I get is:
a find() query for effects collection (only the _id).
a find() query for categories collection, (only the _id), $in of all the unique category ids...
so far so good.
Now for each category I get: find() $in category_id, get only the 'name' field.
Also if multiple effects have the same category, Mandango just keeps querying the DB for that category, even though it already got that data from a previous effect.
The most disturbing thing is that the eager loading doesn't even work, it does the $in query for all the categories but it doesn't use it at all.
What am I doing wrong?
Thanks,
Bar.