Closed huuphuc2401 closed 7 years ago
Thanks for reporting this. I can confirm this is still an issue with 1.9/develop.
Looked at the logic.
This behaviour is correct. The "after_update" observer is called AFTER the update has been completely processed. At this point, the object isn't in altered state anymore, it's state refects the data in the database, so there is no diff between the data in the object, and the data in the database.
Want you need is the "before_save" event, which gives you the state of the object before any save operation is executed, including any observers. You can also use "before_update", but that also gives you any changes made by observers (such as CreatedAt/UpdatedAt, depending on the order the observers are defined in).
The change made in 1.8.0.1 was a bug fix, to correct incorrect behaviour in previous versions.
I have
Model_Product
with propertyname
I add an observer
Observer_Name
to checkname
changed to modelModel_Product
Update name
Expected result
var_dump
display the diff ofnew name
andold name
Result
var_dump
display 2 empty arraysMore information
"fuel/orm":"1.8.*"
.fuel/orm
version 1.8.0.1 is downloaded. Then I got this problem"fuel/orm":"1.8.0"
in composer.json, it work well (display the diff). The old version 1.7 work well too.