-
Notifications
You must be signed in to change notification settings - Fork 66
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
Relationship data generator is invoked more than once if data is empty #252
Comments
@neomerx see you haven't been active on Github since March last year. Hope everything is ok. Hope you can tag the fix as |
Thanks! I also started my own fork as I need to add the missing pieces to the API, such as pagination and filtering. |
@mahagr looks like I'm going to have to run a fork too, as I'm not sure that PR is going to get merged. My fork is here: |
Hey @neomerx, do you need some help maintain this repo? |
I am wondering the same. Otherwise, it would make sense to have an official fork instead of everyone doing their own. |
Hey it seems this project is not maintained anymore. Did you agree which fork should be the "official" one? |
I can create and maintain something like |
@lindyhopchris created a fork and already has v5.0.0 in it maybe he wants to or you can adapt his changes? |
Yeah I'm happy to maintain my fork because it's a critical part of Laravel JSON:API. I'm not up for doing any re-writing, more just keeping it up-to-date for PHP versions and with the spec if that does change (though it's taking them ages to get to 1.1 any way, so doubt we'll be talking about 1.2 any time soon). |
Making it (fork) framework/library agnostic should be better for long term maintenance. |
Yeah to be clear, even though it's in the So my fork will always remain framework agnostic. |
But name can be confusing for newcomers :) |
Yeah can see that. FWIW I'm planning on keeping my fork for the time being. If there comes a point where there's another fork that is fully supported and maintained, then I can switch to that in the future. |
Alright, I'm going to look into switching to laravel fork myself when I get back to the API. |
Thank @lindyhopchris .. i will switch to your fork next time i'll do any upgrades.. thanks for your work. |
Hello guys, it's been a while but I started my fork of this library - https://github.com/jsonapiphp/jsonapi. It started with |
I've been getting this error:
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, theparsedResources
property will remainnull
. 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.
The text was updated successfully, but these errors were encountered: