A PHP package for mapping remote {json:api} resources to Eloquent like models and collections.
\Swis\JsonApi\Client\Exceptions\ValidationException
is thrown instead of \Art4\JsonApiClient\Exception\ValidationException
#58.hasAttribute
to ItemInterface
.\Swis\JsonApi\Client\Exceptions\Exception
.null
) links are correctly parsed.null
) singular relationships are correctly parsed.This is a big release to improve the overall code quality and align some inconsistencies. Please note it includes several breaking changes so read through all changes carefully when upgrading!
DocumentFactory
#52.DocumentFactory
, DocumentParser
, ItemHydrator
, ResponseParser
and TypeMapper
.DocumentParserInterface
and ResponseParserInterface
interfaces and implementations #54.TypeMapper
now checks if the class exists in the setter instead of the getter.ItemHydrator
now also hydrates the id if provided #53.hasType
, hasAttributes
, hasRelationships
and getRelations
to ItemInterface
#53.canBeIncluded
and getIncluded
from ItemInterface
as the DocumentFactory
is now responsible for gathering the included items #53.getRelationship
to getRelation
, hasRelationship
to hasRelation
and removeRelationship
to unsetRelation
in Item
#53.Item
#53.Swis\JsonApi\Client\Traits
to Swis\JsonApi\Client\Concerns
#53.Swis\JsonApi\Client\JsonApi
to Swis\JsonApi\Client\Parsers
#54.ServiceProvider::registerParser
(singular) to ServiceProvider::registerParsers
(plural) #54.CollectionDocumentBuilder
and ItemDocumentBuilder
in favor of DocumentFactory
#52.ParserInterface
in favor of DocumentParserInterface
and ResponseParserInterface
#54.This release includes changes to some interfaces. This is a breaking change if you use these interfaces in your own code.
deleteById
method to simply delete
and removed the 'old' implementation in RepositoryInterface
.
N.B. This is a breaking change and all calls to deleteById
should simply be changed to delete
as the signature is unchanged. The old behaviour of delete
is not supported any more.DocumentInterface::getResponse()
so every document instance can have its corresponding response. This allows access to the underlying response to check headers or status codes etc #48.ParserInterface::deserializeResponse($reponse)
to deserialize a \Psr\Http\Message\ResponseInterface
.ClientInterface
must now return a \Psr\Http\Message\ResponseInterface
for requests instead of our own (removed) ResponseInterface
#48.
N.B. This is a breaking change if you use the Client
directly, the DocumentClient
isn't affected.\Swis\JsonApi\Client\Errors\Error -> \Swis\JsonApi\Client\Error
\Swis\JsonApi\Client\Errors\ErrorCollection -> \Swis\JsonApi\Client\ErrorCollection
\Swis\JsonApi\Client\Errors\ErrorSource -> \Swis\JsonApi\Client\ErrorSource
ResponseInterface
and Response
classes #48.This release includes changes to some interfaces #47. This is a breaking change if you use these interfaces in your own code.
take
method to Repository
to allow fetching resources without id.ItemInterface
.Jsonapi
class.OneRelationInterface
and ManyRelationInterface
.Link
and Links
classes.Error
.Error::getMeta()
now returns a Meta
instance instead of an ErrorMeta
instance. The Meta
class does not have the has
and get
methods, but uses magic overloading methods (e.g. __get
and __set
) just like Item
.
N.B. This is a breaking change if you use meta on errors.DocumentInterface::getLinks()
now returns a Links
instance instead of a plain array. If no links are present, it returns null
. All implementations have been updated to reflect these changes.
N.B. This is a minor breaking change if you use links on documents.DocumentInterface::getMeta()
now returns a Meta
instance instead of a plain array. If no meta is present, it returns null
. All implementations have been updated to reflect these changes.
N.B. This is a minor breaking change if you use meta on documents.DocumentInterface::getJsonapi()
now returns a Jsonapi
instance instead of a plain array. If no jsonapi is present, it returns null
. All implementations have been updated to reflect these changes.ItemInterface::setRelation()
have changed to include optional Links
and Meta
objects.JsonApi\ErrorsParser
, JsonApi\Hydrator
and JsonApi\Parser
have an extra dependency in their constructor.
N.B. Make sure to add this dependency if you've overwritten ServiceProvider::registerParser
or construct the JsonApi\Parser
yourself.ErrorMeta
class in favor of generic Meta
class.This release includes changes to some interfaces #45. This is a breaking change if you use these interfaces in your own code.
OneRelationInterface
and ManyRelationInterface
to differentiate between singular and plural relations.ItemDocumentBuilder
, ItemHydrator
and Repository
classes.setType
and getType
from RelationInterface
to a separate interface; TypedRelationInterface
.ItemInterface::setRelation
.Item::hasAttribute
.RelationInterface
in favor of OneRelationInterface
and ManyRelationInterface
.setId
and getId
from HasOneRelation
and MorphToRelation
. These operations should be performed on the included item.setType
and getType
from morph relations. Use regular relations if you want to set the type.