Yii Framework Forum: Caching Breaks Fully Qualified Behavior Path. - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Caching Breaks Fully Qualified Behavior Path. Rate Topic: -----

#1 User is offline   le_top 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 386
  • Joined: 08-June 10
  • Location:France (Ile-de-France/Val d'Oise)

Posted 27 May 2013 - 07:29 PM

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.*',
        ),


0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users