Skip to content
This repository was archived by the owner on Aug 17, 2025. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
language: php

php:
- "5.3"
- "5.4"
- "5.5"
- "5.6"
- "7.0"

before_install:
- wget http://cs.sensiolabs.org/get/php-cs-fixer.phar
Expand Down
5 changes: 2 additions & 3 deletions Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@

namespace PhlyRestfully;

use Zend\Stdlib\Hydrator\HydratorInterface;
use Zend\Stdlib\Hydrator\HydratorPluginManager;
use Zend\Hydrator\HydratorPluginManager;

/**
* ZF2 module
Expand Down Expand Up @@ -197,7 +196,7 @@ public function onBootstrap($e)
$events = $app->getEventManager();
$events->attach('render', array($this, 'onRender'), 100);
$sharedEvents = $events->getSharedManager();
$sharedEvents->attach('PhlyRestfully\ResourceController', 'dispatch', function($e) use ($services) {
$sharedEvents->attach('PhlyRestfully\ResourceController', 'dispatch', function ($e) use ($services) {
$eventManager = $e->getApplication()->getEventManager();
$eventManager->attach($services->get('PhlyRestfully\ApiProblemListener'));
}, 300);
Expand Down
29 changes: 15 additions & 14 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,23 @@
}
],
"require": {
"php": ">=5.3.3",
"zendframework/zend-eventmanager": ">=2.2.0",
"zendframework/zend-json": ">=2.2.0",
"zendframework/zend-loader": ">=2.2.0",
"zendframework/zend-mvc": ">=2.2.0",
"zendframework/zend-paginator": ">=2.2.0",
"zendframework/zend-uri": ">=2.2.0",
"zendframework/zend-view": ">=2.2.0",
"zendframework/zend-stdlib": ">=2.2.0"
"php": "^5.5 || ^7.0",
"zendframework/zend-eventmanager": "^2.5",
"zendframework/zend-json": "^2.5",
"zendframework/zend-loader": "^2.5",
"zendframework/zend-mvc": "^2.5",
"zendframework/zend-paginator": "^2.5",
"zendframework/zend-uri": "^2.5",
"zendframework/zend-view": "^2.5",
"zendframework/zend-stdlib": "^2.5",
"zendframework/zend-hydrator": "^1.1"
},
"require-dev": {
"phpunit/PHPUnit": "3.7.*",
"zendframework/zend-console": ">=2.2.0",
"zendframework/zend-http": ">=2.2.0",
"zendframework/zend-navigation": ">=2.2.0",
"zendframework/zend-servicemanager": ">=2.2.0"
"phpunit/PHPUnit": "^4.8",
"zendframework/zend-console": "^2.5",
"zendframework/zend-http": "^2.5",
"zendframework/zend-navigation": "^2.5",
"zendframework/zend-servicemanager": "^2.5"
},
"autoload": {
"psr-0": {
Expand Down
8 changes: 4 additions & 4 deletions docs/api/phpdoc/classes/PhlyRestfully.Metadata.html
Original file line number Diff line number Diff line change
Expand Up @@ -135,13 +135,13 @@ <h3>Returns</h3>
</div>
<a id="method_getHydrator"></a><div class="element clickable method public method_getHydrator" data-toggle="collapse" data-target=".method_getHydrator .collapse">
<h2>Retrieve the hydrator to associate with this class, if any</h2>
<pre>getHydrator() : null | \Zend\Stdlib\Hydrator\HydratorInterface</pre>
<pre>getHydrator() : null | \Zend\Hydrator\HydratorInterface</pre>
<div class="labels"></div>
<div class="row collapse"><div class="detail-description">
<div class="long_description"></div>
<h3>Returns</h3>
<div class="subelement response">
<code>null</code><code>\Zend\Stdlib\Hydrator\HydratorInterface</code>
<code>null</code><code>\Zend\Hydrator\HydratorInterface</code>
</div>
</div></div>
</div>
Expand Down Expand Up @@ -253,7 +253,7 @@ <h3>Returns</h3>
</div>
<a id="method_setHydrator"></a><div class="element clickable method public method_setHydrator" data-toggle="collapse" data-target=".method_setHydrator .collapse">
<h2>Set the hydrator to use with this class</h2>
<pre>setHydrator(string | \Zend\Stdlib\Hydrator\HydratorInterface $hydrator) : <a href="../classes/PhlyRestfully.Metadata.html">\PhlyRestfully\Metadata</a></pre>
<pre>setHydrator(string | \Zend\Hydrator\HydratorInterface $hydrator) : <a href="../classes/PhlyRestfully.Metadata.html">\PhlyRestfully\Metadata</a></pre>
<div class="labels"></div>
<div class="row collapse"><div class="detail-description">
<div class="long_description"></div>
Expand All @@ -264,7 +264,7 @@ <h2>Set the hydrator to use with this class</h2>
<h3>Parameters</h3>
<div class="subelement argument">
<h4>$hydrator</h4>
<code>string</code><code>\Zend\Stdlib\Hydrator\HydratorInterface</code>
<code>string</code><code>\Zend\Hydrator\HydratorInterface</code>
</div>
<h3>Exceptions</h3>
<table class="table table-bordered"><tr>
Expand Down
12 changes: 6 additions & 6 deletions docs/api/phpdoc/classes/PhlyRestfully.Plugin.HalLinks.html
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ <h3>
<i class="icon-custom icon-method"></i> Methods</h3>
<a id="method_addHydrator"></a><div class="element clickable method public method_addHydrator" data-toggle="collapse" data-target=".method_addHydrator .collapse">
<h2>Map a resource class to a specific hydrator instance</h2>
<pre>addHydrator(string $class, \Zend\Stdlib\Hydrator\HydratorInterface $hydrator) : \PhlyRestfully\Plugin\RestfulJsonRenderer</pre>
<pre>addHydrator(string $class, \Zend\Hydrator\HydratorInterface $hydrator) : \PhlyRestfully\Plugin\RestfulJsonRenderer</pre>
<div class="labels"></div>
<div class="row collapse"><div class="detail-description">
<div class="long_description"></div>
Expand All @@ -121,7 +121,7 @@ <h4>$class</h4>
</div>
<div class="subelement argument">
<h4>$hydrator</h4>
<code>\Zend\Stdlib\Hydrator\HydratorInterface</code>
<code>\Zend\Hydrator\HydratorInterface</code>
</div>
<h3>Returns</h3>
<div class="subelement response"><code>\PhlyRestfully\Plugin\RestfulJsonRenderer</code></div>
Expand Down Expand Up @@ -288,7 +288,7 @@ <h3>Returns</h3>
</div>
<a id="method_getHydratorForResource"></a><div class="element clickable method public method_getHydratorForResource" data-toggle="collapse" data-target=".method_getHydratorForResource .collapse">
<h2>Retrieve a hydrator for a given resource</h2>
<pre>getHydratorForResource(object $resource) : \Zend\Stdlib\Hydrator\HydratorInterface | false</pre>
<pre>getHydratorForResource(object $resource) : \Zend\Hydrator\HydratorInterface | false</pre>
<div class="labels"></div>
<div class="row collapse"><div class="detail-description">
<div class="long_description"><p>If the resource has a mapped hydrator, returns that hydrator. If not, and
Expand All @@ -301,7 +301,7 @@ <h4>$resource</h4>
</div>
<h3>Returns</h3>
<div class="subelement response">
<code>\Zend\Stdlib\Hydrator\HydratorInterface</code><code>false</code>
<code>\Zend\Hydrator\HydratorInterface</code><code>false</code>
</div>
</div></div>
</div>
Expand Down Expand Up @@ -410,14 +410,14 @@ <h4>$controller</h4>
</div>
<a id="method_setDefaultHydrator"></a><div class="element clickable method public method_setDefaultHydrator" data-toggle="collapse" data-target=".method_setDefaultHydrator .collapse">
<h2>Set the default hydrator to use if none specified for a class.</h2>
<pre>setDefaultHydrator(\Zend\Stdlib\Hydrator\HydratorInterface $hydrator) : \PhlyRestfully\Plugin\RestfulJsonRenderer</pre>
<pre>setDefaultHydrator(\Zend\Hydrator\HydratorInterface $hydrator) : \PhlyRestfully\Plugin\RestfulJsonRenderer</pre>
<div class="labels"></div>
<div class="row collapse"><div class="detail-description">
<div class="long_description"></div>
<h3>Parameters</h3>
<div class="subelement argument">
<h4>$hydrator</h4>
<code>\Zend\Stdlib\Hydrator\HydratorInterface</code>
<code>\Zend\Hydrator\HydratorInterface</code>
</div>
<h3>Returns</h3>
<div class="subelement response"><code>\PhlyRestfully\Plugin\RestfulJsonRenderer</code></div>
Expand Down
24 changes: 12 additions & 12 deletions docs/api/phpdoc/structure.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1327,9 +1327,9 @@ underscores.&lt;/p&gt;
<docblock line="127">
<description>Retrieve the hydrator to associate with this class, if any</description>
<long-description></long-description>
<tag line="127" name="return" description="" type="null|\Zend\Stdlib\Hydrator\HydratorInterface">
<tag line="127" name="return" description="" type="null|\Zend\Hydrator\HydratorInterface">
<type by_reference="false">null</type>
<type by_reference="false">\Zend\Stdlib\Hydrator\HydratorInterface</type>
<type by_reference="false">\Zend\Hydrator\HydratorInterface</type>
</tag>
</docblock>
</method>
Expand Down Expand Up @@ -1452,9 +1452,9 @@ underscores.&lt;/p&gt;
<docblock line="246">
<description>Set the hydrator to use with this class</description>
<long-description></long-description>
<tag line="246" name="param" description="" type="string|\Zend\Stdlib\Hydrator\HydratorInterface" variable="$hydrator">
<tag line="246" name="param" description="" type="string|\Zend\Hydrator\HydratorInterface" variable="$hydrator">
<type by_reference="false">string</type>
<type by_reference="false">\Zend\Stdlib\Hydrator\HydratorInterface</type>
<type by_reference="false">\Zend\Hydrator\HydratorInterface</type>
</tag>
<tag line="246" name="return" description="" type="self">
<type by_reference="false">self</type>
Expand Down Expand Up @@ -3691,8 +3691,8 @@ replaced with a RestfulJsonModel containing an API-Problem payload.&lt;/p&gt;</l
<tag line="194" name="param" description="" type="string" variable="$class">
<type by_reference="false">string</type>
</tag>
<tag line="194" name="param" description="" type="\Zend\Stdlib\Hydrator\HydratorInterface" variable="$hydrator">
<type by_reference="false">\Zend\Stdlib\Hydrator\HydratorInterface</type>
<tag line="194" name="param" description="" type="\Zend\Hydrator\HydratorInterface" variable="$hydrator">
<type by_reference="false">\Zend\Hydrator\HydratorInterface</type>
</tag>
<tag line="194" name="return" description="" type="\PhlyRestfully\Plugin\RestfulJsonRenderer">
<type by_reference="false">\PhlyRestfully\Plugin\RestfulJsonRenderer</type>
Expand All @@ -3706,7 +3706,7 @@ replaced with a RestfulJsonModel containing an API-Problem payload.&lt;/p&gt;</l
<argument line="201">
<name>$hydrator</name>
<default></default>
<type>\Zend\Stdlib\Hydrator\HydratorInterface</type>
<type>\Zend\Hydrator\HydratorInterface</type>
</argument>
</method>
<method final="false" abstract="false" static="false" visibility="public" namespace="PhlyRestfully\Plugin" line="213" package="Default">
Expand All @@ -3715,8 +3715,8 @@ replaced with a RestfulJsonModel containing an API-Problem payload.&lt;/p&gt;</l
<docblock line="207">
<description>Set the default hydrator to use if none specified for a class.</description>
<long-description></long-description>
<tag line="207" name="param" description="" type="\Zend\Stdlib\Hydrator\HydratorInterface" variable="$hydrator">
<type by_reference="false">\Zend\Stdlib\Hydrator\HydratorInterface</type>
<tag line="207" name="param" description="" type="\Zend\Hydrator\HydratorInterface" variable="$hydrator">
<type by_reference="false">\Zend\Hydrator\HydratorInterface</type>
</tag>
<tag line="207" name="return" description="" type="\PhlyRestfully\Plugin\RestfulJsonRenderer">
<type by_reference="false">\PhlyRestfully\Plugin\RestfulJsonRenderer</type>
Expand All @@ -3725,7 +3725,7 @@ replaced with a RestfulJsonModel containing an API-Problem payload.&lt;/p&gt;</l
<argument line="213">
<name>$hydrator</name>
<default></default>
<type>\Zend\Stdlib\Hydrator\HydratorInterface</type>
<type>\Zend\Hydrator\HydratorInterface</type>
</argument>
</method>
<method final="false" abstract="false" static="false" visibility="public" namespace="PhlyRestfully\Plugin" line="229" package="Default">
Expand All @@ -3739,8 +3739,8 @@ Otherwise, a boolean false is returned.&lt;/p&gt;</long-description>
<tag line="219" name="param" description="" type="object" variable="$resource">
<type by_reference="false">object</type>
</tag>
<tag line="219" name="return" description="" type="\Zend\Stdlib\Hydrator\HydratorInterface|false">
<type by_reference="false">\Zend\Stdlib\Hydrator\HydratorInterface</type>
<tag line="219" name="return" description="" type="\Zend\Hydrator\HydratorInterface|false">
<type by_reference="false">\Zend\Hydrator\HydratorInterface</type>
<type by_reference="false">false</type>
</tag>
</docblock>
Expand Down
2 changes: 1 addition & 1 deletion docs/ref/metadata-map.rst
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ Metadata options
The following options are available for metadata maps:

- **hydrator**: the fully qualified class name of a hydrator, or a service name
``Zend\Stdlib\Hydrator\HydratorPluginManager`` recognizes, to use to extract
``Zend\Hydrator\HydratorPluginManager`` recognizes, to use to extract
the resource. (**OPTIONAL**)
- **identifier_name**: the resource parameter corresponding to the identifier;
defaults to "id". (**OPTIONAL**)
Expand Down
4 changes: 2 additions & 2 deletions src/PhlyRestfully/Metadata.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

namespace PhlyRestfully;

use Zend\Stdlib\Hydrator\HydratorInterface;
use Zend\Stdlib\Hydrator\HydratorPluginManager;
use Zend\Hydrator\HydratorInterface;
use Zend\Hydrator\HydratorPluginManager;

class Metadata
{
Expand Down
2 changes: 1 addition & 1 deletion src/PhlyRestfully/MetadataMap.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

namespace PhlyRestfully;

use Zend\Stdlib\Hydrator\HydratorPluginManager;
use Zend\Hydrator\HydratorPluginManager;

class MetadataMap
{
Expand Down
4 changes: 2 additions & 2 deletions src/PhlyRestfully/Plugin/HalLinks.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
use Zend\Paginator\Paginator;
use Zend\Stdlib\ArrayUtils;
use Zend\Stdlib\DispatchableInterface;
use Zend\Stdlib\Hydrator\HydratorInterface;
use Zend\Stdlib\Hydrator\HydratorPluginManager;
use Zend\Hydrator\HydratorInterface;
use Zend\Hydrator\HydratorPluginManager;
use Zend\View\Helper\AbstractHelper;
use Zend\View\Helper\ServerUrl;
use Zend\View\Helper\Url;
Expand Down
34 changes: 17 additions & 17 deletions src/PhlyRestfully/Resource.php
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,9 @@ public function create($data)

$events = $this->getEventManager();
$event = $this->prepareEvent(__FUNCTION__, array('data' => $data));
$results = $events->triggerUntil($event, function($result) {
$results = $events->triggerEventUntil(function ($result) {
return $result instanceof ApiProblem;
});
}, $event);
$last = $results->last();
if (!is_array($last) && !is_object($last)) {
return $data;
Expand Down Expand Up @@ -229,9 +229,9 @@ public function update($id, $data)

$events = $this->getEventManager();
$event = $this->prepareEvent(__FUNCTION__, compact('id', 'data'));
$results = $events->triggerUntil($event, function($result) {
$results = $events->triggerEventUntil(function ($result) {
return $result instanceof ApiProblem;
});
}, $event);
$last = $results->last();
if (!is_array($last) && !is_object($last)) {
return $data;
Expand Down Expand Up @@ -263,7 +263,7 @@ public function replaceList($data)
gettype($data)
));
}
array_walk($data, function($value, $key) use(&$data) {
array_walk($data, function ($value, $key) use (&$data) {
if (is_array($value)) {
$data[$key] = (object) $value;
return;
Expand All @@ -278,9 +278,9 @@ public function replaceList($data)
});
$events = $this->getEventManager();
$event = $this->prepareEvent(__FUNCTION__, array('data' => $data));
$results = $events->triggerUntil($event, function($result) {
$results = $events->triggerEventUntil(function ($result) {
return $result instanceof ApiProblem;
});
}, $event);
$last = $results->last();
if (!is_array($last) && !is_object($last)) {
return $data;
Expand Down Expand Up @@ -320,9 +320,9 @@ public function patch($id, $data)

$events = $this->getEventManager();
$event = $this->prepareEvent(__FUNCTION__, compact('id', 'data'));
$results = $events->triggerUntil($event, function($result) {
$results = $events->triggerEventUntil(function ($result) {
return $result instanceof ApiProblem;
});
}, $event);
$last = $results->last();
if (!is_array($last) && !is_object($last)) {
return $data;
Expand All @@ -344,9 +344,9 @@ public function delete($id)
{
$events = $this->getEventManager();
$event = $this->prepareEvent(__FUNCTION__, array('id' => $id));
$results = $events->triggerUntil($event, function($result) {
$results = $events->triggerEventUntil(function ($result) {
return $result instanceof ApiProblem;
});
}, $event);
$last = $results->last();
if (!is_bool($last) && !$last instanceof ApiProblem) {
return false;
Expand All @@ -373,9 +373,9 @@ public function deleteList($data = null)
}
$events = $this->getEventManager();
$event = $this->prepareEvent(__FUNCTION__, array('data' => $data));
$results = $events->triggerUntil($event, function($result) {
$results = $events->triggerEventUntil(function ($result) {
return $result instanceof ApiProblem;
});
}, $event);
$last = $results->last();
if (!is_bool($last) && !$last instanceof ApiProblem) {
return false;
Expand All @@ -398,9 +398,9 @@ public function fetch($id)
{
$events = $this->getEventManager();
$event = $this->prepareEvent(__FUNCTION__, array('id' => $id));
$results = $events->triggerUntil($event, function($result) {
$results = $events->triggerEventUntil(function ($result) {
return $result instanceof ApiProblem;
});
}, $event);
$last = $results->last();
if (!is_array($last) && !is_object($last)) {
return false;
Expand All @@ -426,9 +426,9 @@ public function fetchAll()
$events = $this->getEventManager();
$params = func_get_args();
$event = $this->prepareEvent(__FUNCTION__, $params);
$results = $events->triggerUntil($event, function($result) {
$results = $events->triggerEventUntil(function ($result) {
return $result instanceof ApiProblem;
});
}, $event);
$last = $results->last();
if (!is_array($last)
&& !$last instanceof HalCollection
Expand Down
2 changes: 1 addition & 1 deletion src/PhlyRestfully/ResourceController.php
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ public function delete($id)
return $response;
}

public function deleteList()
public function deleteList($data = [])
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be a required parameter, as zend-mvc made it required in 2.2 or 2.3, IIRC. I'll write a test to check, and, of so, update it during merge.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Forgot that removing arguments follows the LSP, so this works fine.

{
if (!$this->isMethodAllowedForCollection()) {
return $this->createMethodNotAllowedResponse($this->collectionHttpOptions);
Expand Down
2 changes: 1 addition & 1 deletion src/PhlyRestfully/View/RestfulJsonRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
use PhlyRestfully\LinkCollection;
use PhlyRestfully\Plugin\HalLinks;
use Zend\Paginator\Paginator;
use Zend\Stdlib\Hydrator\HydratorInterface;
use Zend\Hydrator\HydratorInterface;
use Zend\View\HelperPluginManager;
use Zend\View\Renderer\JsonRenderer;

Expand Down
Loading