Skip to content

Commit 386b26a

Browse files
committed
Merge pull request #4 from andreykin/custom_scenario
add scenarioName property
2 parents 88c88ca + 6466317 commit 386b26a

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

components/ERememberFiltersBehavior.php

+15-2
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@
3737
* 'ERememberFiltersBehavior' => array(
3838
* 'class' => 'application.components.ERememberFiltersBehavior',
3939
* 'defaults'=>array(),
40-
* 'defaultStickOnClear'=>false
40+
* 'defaultStickOnClear'=>false,
41+
* 'scenarioName'=>'search',
4142
* ),
4243
* );
4344
* }
@@ -59,6 +60,11 @@
5960
* $model=new Persons('search');
6061
* $model->setRememberScenario('scene1');
6162
*
63+
* 'scenarioName'=>'search' is a name of a search function in your model. Change this, if you use other function name,
64+
* i.e. if your code looks like:
65+
*
66+
* $model=new Persons('searchSort'));
67+
*
6268
*
6369
* CHANGELOG
6470
*
@@ -101,6 +107,13 @@ class ERememberFiltersBehavior extends CActiveRecordBehavior {
101107
* @var boolean
102108
*/
103109
public $defaultStickOnClear=false;
110+
/**
111+
* Default search scenario name
112+
*
113+
* @var string
114+
*/
115+
public $scenarioName='search';
116+
104117
/**
105118
* Holds a custom stateId key
106119
*
@@ -171,7 +184,7 @@ private function saveSearchValues() {
171184

172185

173186
private function doReadSave() {
174-
if ($this->owner->scenario == 'search' || $this->owner->scenario == $this->rememberScenario ) {
187+
if ($this->owner->scenario == $this->scenarioName || $this->owner->scenario == $this->rememberScenario ) {
175188
$this->owner->unsetAttributes();
176189

177190
// store also sorting order

0 commit comments

Comments
 (0)