Scopes() With Findbypk() Method

Hi All,

I am missing something i guess and not able to get this thing worked…

i have a scope defined as below


      public function scopes() {

      return array(

     	'undeleted'=>array(

            'condition'=>'deleted=\'0\'',

     	),

      );

   }

and i am calling it this way,…


ModelCall::model()->findByPk($id)->undeleted()

this is not doing me the expected thing…

instead if i had used it like following it works…


ModelClass::model()->findByPk($id, "deleted='0'")

Let me know whether scope doesnt work with findByPk or what…

Any help is greatly appreciated…

Thanks

Azy

Bump

I am having similar kind of issue… :(

Please help me out

Thanks

You have to apply the scope(s) before you execute the query.




ModelCall::model()->undeleted()->findByPk($id);



tnx a lot :)

i messed with this thing…