Skip to content
This repository has been archived by the owner on Jan 26, 2018. It is now read-only.

loaded vs saved #28

Open
milkmedia opened this issue Apr 6, 2010 · 2 comments
Open

loaded vs saved #28

milkmedia opened this issue Apr 6, 2010 · 2 comments

Comments

@milkmedia
Copy link

In jheathco/kohana-orm/blob/master/classes/kohana/orm.php#L852 $this->_loaded is set to TRUE, but is the data actually loaded from the database at this point? That is, if the server runs stored procedures etc. on the data would these changes be loaded back in to the model, or are you assuming that the data set on the model is the data that was saved to the database?

My point is $model->_loaded and $model->_saved should be independent, $model->save() should only set _saved to TRUE and then _loaded only if the data is selected again.

@birkir
Copy link

birkir commented Apr 9, 2010

So by that, when $model->save() is triggered, "loaded" would have to be set as FALSE because the data has changed ?

@milkmedia
Copy link
Author

Yeah, in my mind $loaded says 'this is data loaded directly from the database and is a true representation of that data'. As soon as you make changes to that data it is not longer true data loaded from the database, even when you save it from the object it is not "loaded" data, for as I said, the database could run other procedures on it. Does that make sense?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant