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
{{ message }}
This repository has been archived by the owner on Jan 2, 2023. It is now read-only.
suppose we have a request url http://xxx/jsonapi/speakers/1654?include=sessions
the result will be one primary resource of speakers, and it will include sessions, which will come from (in this test scenario) from SpeakerSerializer->sessions()
but that sessions() method gets called twice (and it should be called only once, since there is only 1 primary element). if the request would call for a list of speakers, like so: http://xxx/jsonapi/speakers/?include=sessions, then the SpeakerSerializer->sessions() will get called twice the time of the count of the speakers items
i debugged the code, and found that the SpeakerSerializer->sessions() gets called:
here
AbstractSerializer.php
line 75, inside of public function getRelationship($model, $name)
$relationship = $this->$method($model);
this AbstractSerializer.php:getRelationship() gets called from Resource.php:toArray()
and again the same line (meaning AbstractSerializer.php:getRelationship()) will be called from Document.php::toArray() from within the line saying:
$resources = $this->getIncluded($this->data);
so to sum it up:
Documen.php:toArray() calls the same code twice per each resource, and does so on the line saying $document['data'] = $this->data->toArray();
and just next to it $resources = $this->getIncluded($this->data);
The text was updated successfully, but these errors were encountered:
suppose we have a request url
http://xxx/jsonapi/speakers/1654?include=sessions
the result will be one primary resource of
speakers
, and it will includesessions
, which will come from (in this test scenario) fromSpeakerSerializer->sessions()
but that
sessions()
method gets called twice (and it should be called only once, since there is only 1 primary element). if the request would call for a list ofspeakers
, like so:http://xxx/jsonapi/speakers/?include=sessions
, then theSpeakerSerializer->sessions()
will get called twice the time of the count of thespeakers
itemsi debugged the code, and found that the
SpeakerSerializer->sessions()
gets called:AbstractSerializer.php
line 75, inside of
public function getRelationship($model, $name)
this
AbstractSerializer.php:getRelationship()
gets called from Resource.php:toArray()AbstractSerializer.php:getRelationship()
) will be called fromDocument.php::toArray()
from within the line saying:so to sum it up:
Documen.php:toArray() calls the same code twice per each resource, and does so on the line saying
$document['data'] = $this->data->toArray();
and just next to it
$resources = $this->getIncluded($this->data);
The text was updated successfully, but these errors were encountered: