Yii::Useful Scope function.. thanks Yii…

Posted: January 22, 2013 in Php, Yii Framework
Tags: ,

Yii::Useful Scope function.. thanks Yii…

For those who miss the useful of the Scope function inYii, here is the thing that might interest you:

Useful in add-on Search function on gridview / admin view / filter view.

1. In your model/class, add this function:

public function scopes()
            return array(
                    'condition'=>"submit_status='Y' AND approval_status=0",

2. In your gridview, add this to data provider –> $model->pending()->search():

$this->widget('zii.widgets.grid.CGridView', array(



Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s