My condition involves one ‘Log’ field, I have to join it. But Yii tries to bring back fields from ‘Log’, which causes the SQL COUNT to fail.
I can use ‘join’ property from CDbCriteria, but I’m avoiding it because my relation with ‘LOG’ is a bit complex and I want to reuse the relation I defined on ‘Person’.
Yii actually is not joining the related table defined by the STAT relation
Note: I’m using 1.0.12 version.
After thinking a bit, I reached a conclusion: What I’m trying to do does not make so much sense.
When I use ‘with’, I am trying to retrieve a related table with its results, which is not the case. I just want to JOIN to filter my results based on a field from a second table.
So, I actually resolved it with ‘JOIN’ attribute from CDbCriteria.
This was not best solution, as I had to write AGAIN the JOIN condition.
The best solution would be if JOIN property could REUSE a predefined AR Relation.