I’m new to yii, I’m still investigating how suitable the framework is for my purposes.
My question is simple. I load an AR from the DB to allow the user to modify it. Does somehow the AR object checks if the AR was changed before saving?
After checking the code it seems to me that there is no check for this. Practically I could not find any code that would represent the state of the AR with the exception of representing whether the AR is new or a loaded record.
Thanks for the answer! I’m new to the LAMP world. I’ve spent 2 hours to find a MySql profiler without too much success. But you gave me the opportunity to get know a new class CWebLogRoute
Anyway, adding such a feature - managing AR state - seems to be easy and could improve db performance as well.
I do not think it would make much difference… Actually I think it would be a "bloat" feature.
e.g, why would a user even click "update" if he/she did not change any fields on a said update form? I know I am only looking at one case, but I can not think of any cases where this feature would help.
Sometimes programmers want models saved even if no data was changed. For instance, maybe they got something going on in beforeSave() that changes something
This has already been discussed, so try some forum recherche. There where some solutions for this. I even thought we had an extension for it but can’t find it now. A basic implementation as a behaviour would be pretty easy. As Yii tries to stay as slim as possible you’ll probably never see this in the core.
@Horacio:
This is a “well know problem” and it also has some well known solutions. Spend some minutes on a forum search and you’ll find.