In my ORM model, I'd like to save some default values which are calculated based on other values. The best I could come up with is:
function save(){
if( ! $this->loaded()){
// Set values here
}
parent::save();
}
Does anybody know if there is a better/recommended way to do this, or should this be sufficient for most cases? Thanks :)
Your implementation is good. The only improvement you could do is just replace your condition to:
if (!$this->_loaded) {