yiisoft / yii2

Yii 2: The Fast, Secure and Professional PHP Framework
http://www.yiiframework.com
BSD 3-Clause "New" or "Revised" License
14.23k stars 6.92k forks source link

Model modification data failed #20234

Closed 2723659854 closed 1 month ago

2723659854 commented 1 month ago

What steps will reproduce the problem?

//Business code

$service = Service::findOne(1);
//$service['news'] = 0;
$service["last_reply_at"] = time();
$service["news"] = 1;
$service["status"] = 9;
$service->save();

Other attributes have already been modified, such as last_reply_at and status. But the field news can sometimes be changed to 1, but sometimes it is still 0 and has not been modified.

What is the expected result?

Attributes can be modified correctly,The correct value in the database should be 1, not 0。

//$service['news'] = 1;

What do you get instead?

please fix this bug.

Additional info

Q A
Yii version 2.0.49.3
PHP version 8.2.9
Operating system LINUX
samdark commented 1 month ago

What's returned from ->save()?

2723659854 commented 1 month ago

What's returned from ->save()?

sorry ,It was other operations that modified the data.And thank you very much,It's my mistake.

2723659854 commented 1 month ago

thank you