self::STAT and defaultScope in relational model

Hi.

I have a model and a rmodel.

rmodel has stat relation with model:


'm'=>(array(self::STAT, 'model', 'rId'))

and model has default scope with condition 't.someField in (<bla bla bla>)

So when i’m trying to get


rmodel::model()->with('m')->findAll($someCriteria);

alias for model is ‘s’, but in default scope i’m using ‘t’.

How to override this or can I use addInCondition in defaultScope to set field without alias?

As I can see in 1.1.1 source, addInCondition does not add table prefix to a column, so what is the solution?

Better way - to define some property for each model in array, which will show count of related model elements.

Any ideas?

Scopes don’t work too well when dealing with joins. It may be that you’re doing something a little too complicated with it… or maybe not… it’s hard to tell what overall problem you’re trying to solve. We tried using default scopes and it always seemed to mess things up so we dropped them.

Hi guys, any solution this? we are also facing the same problem and it seems that we will also need to drop the default scope from all the models as its not working well with relational models if the the column names are same.