I have this very weird problem in yii2,
public function actionUpdate($draftId) {
$model = $this->findModel($draftId);
// $model->product_title = \filter_var(\trim($_POST['product_title']), \FILTER_SANITIZE_STRING,\FILTER_FLAG_NO_ENCODE_QUOTES);
$model->product_title;
$model->updated_at = \time();
$model->unit_price = "6666";
//echo $model->updated_at;
//exit();
if ($model->save()) {
echo "success";
} else {
echo "fail";
}
}
In my Model i have this
class Draft extends \yii\db\ActiveRecord
{
public $created_at;
public $updated_at;
/**
* @inheritdoc
*/
public static function tableName()
{
return 'draft';
}
/**
* @inheritdoc
*/
i have no rule set in my Model
Now if i tried to save this in DB only the $model->updated_at don't get saved, i try to echo the outcome and i got the timestamp as expected but it would not save in database, i try check the column type and it's in INT so it shouldn't have any problem but still it has, anyone can help me on this