swisnl / json-api-client

A PHP package for mapping remote {json:api} resources to Eloquent like models and collections.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

jsonSerialize dont serialize "included"

bondas83 opened this issue · comments

Detailed description

If we get data from funcion return $this->client->get($this->endpoint.'?'.http_build_query($parameters)); ant then json encode, it didnt return included parameters

Make it clear if the issue is a bug, an enhancement or just a question.

BUG

Why is this change important to you? How would you use it?

If i get data from json api and want to return to Frontent i should do some extra steps

Possible implementation

File CollectionDocument.php

Add extra line:

if ($this->getIncluded()) {
            $document['included'] = $this->included->toArray();
        }

Not obligatory, but suggest an idea for implementing addition or change.

Your environment

Include as many relevant details about the environment you experienced the bug in and how to reproduce it.

  • Version used (e.g. PHP 7.2, HHVM 3):
  • Operating system and version (e.g. Ubuntu 16.04, Windows 7):
  • Link to your project:
  • ...
  • ...

@bondas83, thanks for reporting this issue. I've released 0.11.0 with a fix.