-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
State problem #46
Comments
While it is a simple change, I can also see the opportunity of that mucking up other things. For example, if someone extended I've been aware of this "problem", but never could come up with a nice way to solve it. |
Mmh... Good point. I think what I suggested is closer from a correct behavior though.
And then in the load method, you would simply set the loading param to true when using as_object :
I haven't tested this at all, this is just an idea, but I think it could fix the issue... I just think it is pretty crucial to know if the object is loading or not when processing values in the magic __set method... EDIT : Sorry I am not sure that will work now... Magic __set will probably be called before the status is set to loading... |
There is an issue with how states behaves. Luckily, it is easy to fix. This is the problem :
Will actually load the object. So the state is initially set to NEW, then to LOADING in the load method, then LOADED. That makes complete sense.
Will create the object from mysql_query_object. So the state is initially NEW, then direcly set to LOADED when the object is set. No LOADING.
This is especially annoying as mysql_query_object uses the magic __set(), whereas, load directly se the data in the _data array. So if in your magic set you want to do checks if the object is loading or if it is a manual set, you cannot rely on states...
The fix is simple : default AutoModeler state to STATE_LOADING, then in the construct method add an "else" statement to set to state to new if is not loading nor loaded (first two cases):
The text was updated successfully, but these errors were encountered: