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

How To Override Cactiverecord::save()

$
0
0
Hi Folks,

I want over-ride the save function of CActiveRecord like this way,

public function save()
    {
        try
        {   
            /***do calculations on attributes here ***/      
            return parent::save();

        } catch (Exception $exception)
        {
            echo $exception->getMessage();
            return false;
        }
    }


So I will do change on attributes before saving, .. in this way I am keeping, my business in model.
But, when I do error_reporting(-1).. means all errors are shown, I am getting the error message as,

Declaration of modelname::save() should be compatible with that of CActiveRecord::save()

Viewing all articles
Browse latest Browse all 18717


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