Skip to content

2.0.0 - Improvements to serialization and transformation process (BC)

Choose a tag to compare

@jodiedunlop jodiedunlop released this 05 Jul 08:29

This is a major release due to a breaking changes in both the RelationLoaderInterface and SerializerInterface classes.

It also contains a major refactor of the transformation process.

Breaking Changes

  • The RelationLoaderInterface load() method now requires a second argument (array), which is a list of relationship keys to be loaded. The first argument is now the original ResourceInterface object that the relationships should be loaded off of.
  • The SerializerInterface class requires implementing nullItem() and nullCollection() methods.
  • The DefaultSerializer class has been updated to implement these methods (returns null and [] respectively).

Fixes / Changes

  • Refactored the transformation and serialization process into a pipeline which composes Scope objects, this better encapsulates the transformation process and makes extending and reasoning about includes and relationships much easier
  • Include methods will now be given a second argument of the Scope object that it is running within. This enables those methods to examine the Scope.
  • Fix a regression in handling non-resource entities (such as those that may be returned from an include).
  • Ensure toArray() always returns an array.