Open
Description
I've been getting this error:
Exception: Cannot traverse an already closed generator
src/Parser/RelationshipData/RelationshipDataIsCollection.php:132
It only occurs when relationship data is empty. The cause of the bug is these lines here:
https://github.com/neomerx/json-api/blob/master/src/Parser/RelationshipData/RelationshipDataIsCollection.php#L130-L131
As it does not assign an empty array to $this->parsedResources
before iterating over the resource, the parsedResources
property will remain null
. Therefore when it is called a second time, there is no cache to use and the closed generator is used.
I'll submit a PR with a test reproducing the problem and a fix.
Metadata
Metadata
Assignees
Labels
No labels