Skip to content
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

Entity queried from database after creation on any prop access #12

Closed
crazyproger opened this issue Nov 15, 2015 · 1 comment
Closed
Assignees
Labels

Comments

@crazyproger
Copy link
Contributor

Found some non-obvious behavior: when creating Entity by EntityClass.new with all fields population, then accessing any prop at first time leads to querying this entity from DB. This last query was unexpected for me if I populate all props upon creation.

Internally this is because upon save Entity._readValues backing field is null and written doesn't cached in it.
I think Entity should cache inserted values and return them without additional queries...or maybe I've missed something and this behavior considered as normal?

@Tapac Tapac self-assigned this Nov 18, 2015
@Tapac Tapac added the bug label Nov 18, 2015
@Tapac
Copy link
Contributor

Tapac commented Nov 18, 2015

You are absolutely right about excessive query to retrieve just inserted values for new entities.
We fixed that in d5bef3c , feel free to test and thank you for attention.

@Tapac Tapac closed this as completed Nov 18, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants