ouzo
ouzo copied to clipboard
[ORM] Update should not update columns which did not changed
e.g.
$product = Products::findById(1);
$product->name = 'test';
$product->update();
Should update name column only. Right now it will update everything.
Important:
- before and after callback are invoked regardless of update (e.g. if update is not invoked because nothing changed, callbacks are still invoked) - needs to be added as note to docs
More tests would be nice, especially with updateAttributes.
Why do we need _trackUpdates?
Removed.
unsuccessful insert resets _updatedAttributes update does not reset _updatedAttributes probably unsuccessful update should not reset _updatedAttributes Why do we reset _updatedAttributes in Model::newInstance?