nilportugues / php-json-api

JSON API transformer outputting valid (PSR-7) API Responses.
http://nilportugues.com
MIT License
71 stars 35 forks source link

Fixed "Undefined index: @type" for resource non-empty array fields #97

Closed hainovsky closed 6 years ago

hainovsky commented 6 years ago

On serialization there could be exception "Notice: Undefined index: @type" for root resource non-empty array fields.

It happens due to the fact that we're iterating over all object/resource fields (including array fields) in setResponseDataIncluded and then directly refer to "@type" key in array:2 [▼ "@scalar" => "string" "@value" => "sale" ]

nilportugues commented 6 years ago

@ksxauh awesome, thanks for finding this and providing a PR 👍