0

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 Answer 1

1

You can call ActiveRecord::refresh() - Repopulates this active record with the latest data.

https://www.yiiframework.com/doc/api/2.0/yii-db-activerecord#refresh()-detail

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.