beforeFind and count()

Well, is there any way to set behaviours for count() also?

I use beforeFind behaviour to filter records (i need behaviour, but not scopes) and discover that for count() beforeFind is not called.

So in my case i have wrong information for CPagination! Is there any way to solve it without scopes?!

so looks like almost noone use beforeFind behaviors :(

So, anyone from yii-team…why do u keep silence? Why ‘find’ bevaviours are not working for count()? As for me, i’m sure that count must works same as find.

That peace of code is not working right, if i’m using bevaiours for model:


$pages = new CPagination(SupplierOrder::model()->count($criteria));

Right now, i have to replace all that stuff with:




$pages = new CPagination(SupplierOrder::model()->webRequests()->count($criteria));

And that’s not ok, coz i can’t use behaviours in application due to that fact, right now i replaced all my behaviours with scopes :( Alot of ‘duplicate’ code at controller :( Instead of the only behaviour attachment at during of initialization of controller, i have to manually code that logic inside of each action. That’s not right way.

Please be patient, I’m sure someone who has had some experience with this will help you soon. If it is a bug, then a team member will probably correct it in svn also soon also.

It’s a known issue: http://code.google.com/p/yii/issues/detail?id=764. I’ll fix it sooner or later.