All notable changes to this project will be documented in this file, in reverse chronological order by release.
Versions prior to 0.4.0 were released as the package "weierophinney/hal".
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- #56 fixes an issue calculating the offset when generating a paginated Doctrine collection.
- #55 adds the ability to generate paginated HAL collections from
Doctrine\ORM\Tools\Pagination\Paginatorinstances.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- #51 adds support for zend-hydrator version 3 releases. You may continue to use version 2 releases as well.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
-
#50 fixes the
Halresourceconstructor documentation of the$embeddedargument to correctly be an array ofHalResourcearrays (and not just an array ofHalResourceinstances). -
#41 fixes how
nullvalues in resources are handled when rendering as XML. Previously, these would lead to anInvalidResourceValueException; now they are rendered as content-less tags.
- #39 adds a cookbook recipe detailing how to create a fully contained, path-segregated module, complete with its own router, capable of generating HAL resources.
-
#39 updates
LinkGeneratorFactoryto allow passing an alternate service name to use when retrieving theLinkGenerator\UriGeneratorInterfacedependency. -
#39 updates
ResourceGeneratorFactoryto allow passing an alternate service name to use when retrieving theLinkGeneratordependency.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- #37 modifies
HalResourceto no longer treat empty arrays as embedded collections when passed via the constructor orwithElement(). If an empty embedded collection is required, useembed()with a boolean third argument to force representation as an array of resources.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- #36 fixes an issue whereby query string arguments were not being added to links generated for a resource. It now correctly merges those specified in metadata with those from the request when generating links.
- Nothing.
-
#31 changes the constructor signature of
Zend\Expressive\Hal\HalResponseFactoryto read:public function __construct( callable $responseFactory, Renderer\JsonRenderer $jsonRenderer = null, Renderer\XmlRenderer $xmlRenderer = null )
Previously, the
$responseFactoryargument was aPsr\Http\Message\ResponseInterface $responsePrototype; it is now a PHP callable capable of producing a new, empty instance of that type.Additionally, the signature previously included a callable
$streamFactory; this has been removed. -
#31 updates the
HalResponseFactoryFactoryto follow the changes made to theHalResponseFactoryconstructor. It now requires that aPsr\Http\Message\ResponseInterfaceservice be registered, and that the service resolve to acallablecapable of producing aResponseInterfaceinstance.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- #32 modifies
HalResponseFactoryFactoryto test if aResponseInterfaceservice instance iscallablebefore returning it; if it is, it calls it first. This allows theResponseInterfaceservice to return a response factory instead of an instance.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- #27 modifies
the
XmlRendererto raise an exception when attempting to render objects that are not serializable to strings.
- Nothing.
- Nothing.
- #27 adds
handling for
DateTimeand string serializable objects to theXmlRenderer, allowing them to be rendered.
- #26 adds support for the zend-expressive-helpers 5.0 series of releases.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
-
#23 modifies how the resource generator factory adds strategies and maps metadata to strategies. It now adds the following factories under the
Zend\Expressive\Hal\Metadatanamespace:RouteBasedCollectionMetadataFactoryRouteBasedResourceMetadataFactoryUrlBasedCollectionMetadataFactoryUrlBasedResourceMetadataFactory
Each implements a new
MetadataFactoryInterfaceunder that same namespace that accepts the requested metadata type name and associated metadata in order to create anAbstractMetadatainstance. Metadata types are mapped to their factories under thezend-expressive-hal.metadata-factorieskey.Strategies are now configured as metadata => strategy class pairings under the
zend-expressive-hal.resource-generator.strategieskey.In both cases, defaults that mimic previous behavior are provided via the
ConfigProvider.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- #21 fixes the
LinkGeneratorFactoryto properly use theZend\Expressive\Hal\LinkGenerator\UrlGeneratorInterfaceservice when creating and returning theLinkGeneratorinstance. (0.5.0 was incorrectly attempting to use theUrlGeneratorservice, which does not exist.)
- Nothing.
-
#20 renames the following interfaces and traits to have
InterfaceandTraitsuffixes, respectively; this was done for consistency with existing ZF packages. (Values after the:retain the namespace, which is omitted for brevity.)Zend\Expressive\Hal\LinkGenerator\UrlGenerator:UrlGeneratorInterfaceZend\Expressive\Hal\Renderer\Renderer:RendererInterfaceZend\Expressive\Hal\ResourceGenerator\Strategy:StrategyInterfaceZend\Expressive\Hal\ResourceGenerator\ExtractCollection:ExtractCollectionTraitZend\Expressive\Hal\ResourceGenerator\ExtractInstance:ExtractInstanceTrait
-
#16 renames the various
Exceptioninterfaces toExceptionInterface, in order to be consistent with other ZF packages.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
-
#19 fixes the behavior of
ResourceGeneratorwhen nesting a collection inside another resource to properly nest it as an array of items, rather than a collection resource. -
#18 fixes the return type hint of
RouteBasedResourceMetadata::setRouteParams()to correctly bevoid. -
#13 updates
ExtractCollection::extractPaginator()to validate that the pagination parameter is within the range of pages represented by the paginator instance; if not, anOutOfBoundsExceptionis raised. -
#12 fixes how pagination metadata (
_page,_page_count,_total_items) is represented in generated resources, ensuring values are cast to integers.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
-
#7 fixes a number of issues in the various exception implementations due to failure to import classes referenced in typehints.
-
#6 fixes a number of docblock annotations to reference
HalResourcevsResource(which is a reserved word).
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- #6 fixes an issue with the XML renderer when creating resource elements that represent an array.
- Nothing.
- The package name was changed to "zendframework/zend-expressive-hal".
- The namespace was changed from
HaltoZend\Expressive\Hal.
- Nothing.
- Nothing.
- Nothing.
-
#4 adds the ability to force both links and embedded resources to be rendered as collections, even if the given relation only contains one item.
To force a link to be rendered as a collection, pass the attribute
__FORCE__COLLECTION__with a boolean value oftrue(or use the constantLink::AS_COLLECTIONto refer to the attribute name).To force an embedded resource to be rendered as a collection, pass a boolean
trueas the third argument toembed(). Alternately, pass an array containing the single resource to any of the constructor,withElement(), orembed().
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- #1 adds a
Hal\Renderersubcomponent with the following:RendererinterfaceJsonRenderer, for creating JSON representations ofHalResourceinstances.XmlRenderer, for creating XML representations ofHalResourceinstances.
-
#1 changes
Hal\HalResponseFactoryto compose aJsonRendererandXmlRenderer, instead of composing$jsonFlagsand creating representations itself.It also makes the response prototype and the stream factory the first arguments, as those will be the values most often injected.
The constructor signature is now:
public function __construct( Psr\Http\Message\ResponseInterface $responsePrototype = null, callable $streamFactory = null, Hal\Renderer\JsonRenderer $jsonRenderer = null, Hal\Renderer\XmlRenderer $xmlRenderer = null ) {
-
#1 changes
Hal\HalResponseFactoryFactoryto comply with the new constructor signature ofHal\HalResponseFactory. It also updates to check forPsr\Http\Message\ResponseInterfaceandPsr\Http\Message\StreamInterfaceservices before attempting to use zend-diactoros classes.
- Nothing.
- Nothing.
- Nothing.
- Adds keywords to the
composer.json - Adds a "provides" section to the
composer.json(provides PSR-13 implementation) - Adds
composer.jsonsuggestions for:- PSR-11 implementation
- zend-paginator
- Nothing.
- Nothing.
- Nothing.
- Adds documentation; see the doc/book/ tree, or browse at https://weierophinney.github.io/hal/
- Nothing.
- Nothing.
- Nothing.
- Adds the method
templatedFromRoute()to theLinkGeneratorclass. Acts exactly likefromRoute(), but the generatedLinkinstance will have theisTemplatedproperty toggledtrue.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- Fixes registration of the
MetadataMapin theConfigProvider; it was previously using an incorrect namespace.
- Adds
HalResponseFactoryFactory, a factory for generating aHalResponseFactoryinstance.
- Nothing.
- Nothing.
- Nothing.
-
Adds the ability to inject route params and query string arguments at run-time to the route-based metadata instances.
When dealing with route-based metadata, we may be dealing with sub-resources; in such cases, the route parameters may be derived from the request, and we will want to inject them at run-time.
When dealing with collections, the query string arguments may indicate things such as searches, sort directions, sort columns, filters, limits, etc.; these will be derived from the request, and need to be injected at run-time.
- Nothing.
- Nothing.
- Nothing.
Initial Release.
- Everything.
- Nothing.
- Nothing.
- Nothing.