How can i user a scope in the with()?

i definded a scope in User model,just like :




public function sID($id)

{

...

}



and in controller group,i want use this scope in with()




Groups::model()->with('User');



but i don’t know how to call the sID function in the model User.

Please help!

Thank you!

Try




$result=Groups::model()->sID($id)->with('User')->findAll();



@holala:

You can’t use parameterized scopes in with(), only those defined in scopes(). See the section at the bottom of this page:

http://www.yiiframework.com/doc/guide/database.arr