Quantcast
Channel: Yii Framework Forum
Viewing all articles
Browse latest Browse all 18717

Caching Breaks Fully Qualified Behavior Path.

$
0
0
When a behavior is fully qualified when it is attached to a CActiveRecord like this:

public ExampleModel extends CActiveRecord {

    public function behaviors() {
        return array(
            'ERememberFiltersBehavior' => array(
                'class' => 'ext.ERememberFiltersBehavior.ERememberFiltersBehavior',
                'defaults'=>array(),
                'defaultStickOnClear'=>false,
            ));
}



And the same model is retrieved from cache like this:
$result=Yii::app()->cache->get($key);



Where $key corresponds to a key saved earlier like this:

Yii::app()->cache->set($key,$examplemodel,300)



Then one gets the following error:
include(ERememberFiltersBehavior.php): failed to open stream: No such file or directory




The workaround is to add ERememberFiltersBehavior to the regular search path in the configuration (config.php) like this:

return array(
	[...]
        /* autoloading model and component classes */
        'import'=>array(
                'ext.ERememberFiltersBehavior.*',
        ),


Viewing all articles
Browse latest Browse all 18717

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>