Yii2. The model return an Expression object in the field, instead of a string

Viewed 28

The string is stored in the database as expected. And the object is returned. We are talking about the hash field and hash_actual If you make a second request and do not fall into the condition, then a string will be returned. How to be?

if ($hashDbCurrent !== $hashDbActual || $currentDateTimeStamp >= $updateDateHashTimeStamp) {
        $cdbExpression = new Expression('MD5(NOW())');
                $mba_info->hash = $cdbExpression;
                $mba_info->hash_actual = $cdbExpression;
                $mba_info->last_date_hash_update = $currentDate;
                $mba_info->save();
            }

  return $mba_info;

Before Save we Have String enter image description here

After save we Have object. But we have string in Database. I need string after save enter image description here

1 Answers
Related