Changing Views

Hello All,

I’m new to Yii and am trying to decide the easiest way to limit the amount of data displayed in the index. Specifically, I have two classes, “PaymentSchedule” and “Organization” and only want to display the PaymentSchedule models for the organization that is currently logged in (instead of all the models) in the index of PaymentSchedule. Their relation is,

class PaymentSchedule extends CActiveRecord

public function relations()

{	return array('author'=>array(self::BELONGS_TO, 'Organization', 'org_id'),



Is the best way to do this to create a scope method, change its cbdcriteria, or something else?


It might be the easiest to overwrite the CActiveRecord.defaultScope() method.

I think just change of CDbCriteria will help you to solve your problem(and eventually changes in view file)