GroupedSelection: Rows are refetched after emptyResultSet call [Closes #15] #53
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is EXPERIMENTAL hotfix for very annoying Issue #15.
I can't reproduce the bug. It occurs only sometimes after app deploy & cache clean.
Maybe the problem is that
Selection::emptyResultSet
unsets$rows
property.It's OK because
Selection::execute
is called before work with the property and when is not set it will be created and it will be an array.But in some places there are iterations over it and it reproduces an error.
(On another places there is
foreach ((array) $this->rows ...)
and I can't understand Nette\Database so deeply to make more changes in the code.)I didn't understand why the error is thrown (see #15).
Now I've tried do anything else. In
GroupedSelection
the method::execute
is overriden.But it doesn't write
$rows
property itself. Now I see it callsparent::execute
but it's not called when some cache key is set.So I think it can be the problem here with GroupedSelection.
Selection::emptyResultSet
sets$this->rows = NULL
.GroupedSelection::execute
doesn't callparent::execute
and$rows
property is null even after it has been called.$rows
property is NULL but we use it in foreach cycles or array access).What do you think about it?
I muset wait few days or weeks if error will be away or not but as I've said - I can't reproduce the bug intentionally 😢