Category is an hierarchy. All relations work as expected, ‘projectsCount’ works as well when it is called lazy. When I access the child elements the eager fetch of projectsCount does not work. I can see in my sql trace that they are still lazy loaded:
Yes, you can do this, but using this option inappropriately may form an infinite relation loop. If you try to load Category object with it’s childs - Category objects, which must be loaded with their childs - it might be an infinite relation loop.
Yes it has. But Projects-Categories is not an hierarchy. I think there is an limitation in Yii to put statistical queries as eager fetching into relations. Maybe anybody else has a working example or can confirm that is just don’t work. I guess the sql query behind the scene is to complicated to be generated dynamically by the framework.