protected $date_end; //'date_end' Is a model attribute, do not a table field
protected function getdate_end()
{
Yii::trace("Enter Get","file");
}
protected function setdate_end()
{
Yii::trace("Enter Set","file");
}
Well… why is the Getter dispatched, and the Setter doesn’t?
protected $_date_end; //'date_end' Is a model attribute, do not a table field
protected function get_date_end()
{
Yii::trace("Enter Get","file");
}
protected function set_date_end($par)
{
Yii::trace("Enter Set","file");
}
$private $_date_end // or protected...
public function getDate_end(){
return $this->_date_end;
}
public function setDate_end($val){
$this->_date_end = $val;
}
//Usage...
$d = $model->date_end;
$model->date_end = '2010-10-06';
Obviusly, because getXXX and setXXX are function, you can do your own stuff…
Wow PoL, thanks. I expected the setter was dispatched when model was saved, but I have realised I was wrong about that. Due to the getter method was called in edition mode, i expected the setter method was called when saving.
Is The correct method to manage data before saving to use beforeSave() overriding? If yes, Is this correct?