You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Model::getRelated() does not reuse already fetched relations that are populated in Model::related and Model::dirtyRelated.
getRelated always fetches fresh relations.
This makes requests slower and the Database heavier, normally there is no advantage by doing this, it only makes the request longer and the probability of a changed row while executing the request to happen, this is already almost impossible with the expected time of a request to be in the milliseconds.
Expected behavior
By default getRelated should reuse the relations in these arrays if not instructed otherwise.
Modell has refresh() to update the current model instance, ResultSet does not have this ability yet.
The text was updated successfully, but these errors were encountered:
It would be great if the pull request for this issue was merged.
I also noticed this but didn't recognize it as a bug so I just extended the models __get() and getRelated() methods to perform the same check as in the pull request and directly return related[$alias] or dirtyRelated[$alias]. That fit the behavior that we expected and fixed this use case for us.
Describe the bug
Model::getRelated() does not reuse already fetched relations that are populated in Model::related and Model::dirtyRelated.
getRelated always fetches fresh relations.
This makes requests slower and the Database heavier, normally there is no advantage by doing this, it only makes the request longer and the probability of a changed row while executing the request to happen, this is already almost impossible with the expected time of a request to be in the milliseconds.
Expected behavior
By default getRelated should reuse the relations in these arrays if not instructed otherwise.
Modell has refresh() to update the current model instance, ResultSet does not have this ability yet.
The text was updated successfully, but these errors were encountered: