Apply A Default Aftersave Behavior

Hi everyone,

which component/class should I extend/override to apply a default afterSave behavior like Yii:log() to it ?

I’ve created a file into components folder like Testing.php and extend the CActiveRecord class but it doens’t seem to have any effect:


class Testing extends CActiveRecord {

	

	protected function afterSave() {

		parent::afterSave();

		echo "Hi";

		exit();

	}

	

}

And I’m already importing it by default:


'import' => array(

        'application.models.*',

        'application.components.*',

...

Some tips about what am I missing ?

you can do this in one of 2 ways:

[list=1]

[*]Create a behaivour that you attach your models to ( http://www.yiiframework.com/doc/guide/1.1/en/extension.create Section 2)

[*]extend your models with a base class that has the before save code in it

[/list]

so for the second it would like like:




class MasterActiveRecord extends CActiveRecord

{

     protected function afterSave() {

                parent::afterSave();

                echo "Hi";

                exit();

     }

}


class Contact extends MasterActiveRecord

{

    //all your model code here...

}