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\Paginator
instances.
- 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
Halresource
constructor documentation of the$embedded
argument to correctly be an array ofHalResource
arrays (and not just an array ofHalResource
instances). -
#41 fixes how
null
values 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
LinkGeneratorFactory
to allow passing an alternate service name to use when retrieving theLinkGenerator\UriGeneratorInterface
dependency. -
#39 updates
ResourceGeneratorFactory
to allow passing an alternate service name to use when retrieving theLinkGenerator
dependency.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- #37 modifies
HalResource
to 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\HalResponseFactory
to read:public function __construct( callable $responseFactory, Renderer\JsonRenderer $jsonRenderer = null, Renderer\XmlRenderer $xmlRenderer = null )
Previously, the
$responseFactory
argument 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
HalResponseFactoryFactory
to follow the changes made to theHalResponseFactory
constructor. It now requires that aPsr\Http\Message\ResponseInterface
service be registered, and that the service resolve to acallable
capable of producing aResponseInterface
instance.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- #32 modifies
HalResponseFactoryFactory
to test if aResponseInterface
service instance iscallable
before returning it; if it is, it calls it first. This allows theResponseInterface
service to return a response factory instead of an instance.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- #27 modifies
the
XmlRenderer
to raise an exception when attempting to render objects that are not serializable to strings.
- Nothing.
- Nothing.
- #27 adds
handling for
DateTime
and 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\Metadata
namespace:RouteBasedCollectionMetadataFactory
RouteBasedResourceMetadataFactory
UrlBasedCollectionMetadataFactory
UrlBasedResourceMetadataFactory
Each implements a new
MetadataFactoryInterface
under that same namespace that accepts the requested metadata type name and associated metadata in order to create anAbstractMetadata
instance. Metadata types are mapped to their factories under thezend-expressive-hal.metadata-factories
key.Strategies are now configured as metadata => strategy class pairings under the
zend-expressive-hal.resource-generator.strategies
key.In both cases, defaults that mimic previous behavior are provided via the
ConfigProvider
.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- #21 fixes the
LinkGeneratorFactory
to properly use theZend\Expressive\Hal\LinkGenerator\UrlGeneratorInterface
service when creating and returning theLinkGenerator
instance. (0.5.0 was incorrectly attempting to use theUrlGenerator
service, which does not exist.)
- Nothing.
-
#20 renames the following interfaces and traits to have
Interface
andTrait
suffixes, 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
:UrlGeneratorInterface
Zend\Expressive\Hal\Renderer\Renderer
:RendererInterface
Zend\Expressive\Hal\ResourceGenerator\Strategy
:StrategyInterface
Zend\Expressive\Hal\ResourceGenerator\ExtractCollection
:ExtractCollectionTrait
Zend\Expressive\Hal\ResourceGenerator\ExtractInstance
:ExtractInstanceTrait
-
#16 renames the various
Exception
interfaces toExceptionInterface
, in order to be consistent with other ZF packages.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
-
#19 fixes the behavior of
ResourceGenerator
when 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, anOutOfBoundsException
is 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
HalResource
vsResource
(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
Hal
toZend\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_COLLECTION
to refer to the attribute name).To force an embedded resource to be rendered as a collection, pass a boolean
true
as 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\Renderer
subcomponent with the following:Renderer
interfaceJsonRenderer
, for creating JSON representations ofHalResource
instances.XmlRenderer
, for creating XML representations ofHalResource
instances.
-
#1 changes
Hal\HalResponseFactory
to compose aJsonRenderer
andXmlRenderer
, instead of composing$jsonFlags
and 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\HalResponseFactoryFactory
to comply with the new constructor signature ofHal\HalResponseFactory
. It also updates to check forPsr\Http\Message\ResponseInterface
andPsr\Http\Message\StreamInterface
services 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.json
suggestions 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 theLinkGenerator
class. Acts exactly likefromRoute()
, but the generatedLink
instance will have theisTemplated
property toggledtrue
.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- Fixes registration of the
MetadataMap
in theConfigProvider
; it was previously using an incorrect namespace.
- Adds
HalResponseFactoryFactory
, a factory for generating aHalResponseFactory
instance.
- 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.