diff --git a/CHANGELOG.md b/CHANGELOG.md index 875e662..414e1b3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ All notable changes to this project will be documented in this file, in reverse chronological order by release. -## 1.2.2 - TBD +## 1.2.2 - 2016-07-27 ### Added @@ -18,7 +18,11 @@ All notable changes to this project will be documented in this file, in reverse ### Fixed -- Nothing. +- [#75](https://github.com/zfcampus/zf-content-negotiation/pull/75) updates the + `JsonModel` to test discovered `ZF\Hal\Entity` instances for a `getEntity()` + method; if found, that method will be used to pull the entity data, but if + not, property overloading to its `$entity` property will be used instead. This + change ensures the component works with versions of zf-hal prior to 1.4. ## 1.2.1 - 2016-07-07 diff --git a/src/JsonModel.php b/src/JsonModel.php index 103fc17..7afc7e9 100644 --- a/src/JsonModel.php +++ b/src/JsonModel.php @@ -79,7 +79,9 @@ public function serialize() // Use ZF\Hal\Entity's composed entity if ($variables instanceof HalEntity) { - $variables = $variables->getEntity(); + $variables = method_exists($variables, 'getEntity') + ? $variables->getEntity() // v1.2+ + : $variables->entity; // v1.0-1.1.* } // Use ZF\Hal\Collection's composed collection