I need help in my active record
I tried all my cards for this but still, I failed so now I’m in need of assistance.
i have a function like this
function updateDuration() {
$this->duration = new Expression("month(startdate) - month(enddate)");
$this->validate();
$this->save();
}
$this->duration // integer type in database
Error is
Object of class yii\db\Expression could not be converted to int
What should i do ? ? ?
Really needed help about this. Thank you very much!
FYI! I love YII2!!! It’s great.