laminas-api-tools / api-tools-admin

Laminas API Tools Admin module
https://api-tools.getlaminas.org/documentation
BSD 3-Clause "New" or "Revised" License
13 stars 21 forks source link

Template rest-resource.phtml is missing param type "Parameters" in fetchAll() #82

Closed ppaulis closed 2 years ago

ppaulis commented 2 years ago

Bug Report

Q A
Version(s) 1.10.3

Summary

In https://github.com/laminas-api-tools/api-tools-rest/pull/28, the parent method AbstractResourceListener#fetchAll() has been updated to support Laminas\Stdlib\Parameters as possible parameter type. Before this fix, the only type was array, and this led to errors on some array functions like e.g. array_key_exists(...).

In consequence, the template in this repository should be updated from:

use Laminas\ApiTools\ApiProblem\ApiProblem;
use Laminas\ApiTools\Rest\AbstractResourceListener;

class <?= $classname ?> extends AbstractResourceListener
{
    ...
    /**
     * Fetch all or a subset of resources
     *
     * @param  array $params
     * @return ApiProblem|mixed
     */
    public function fetchAll($params = [])

to:

use Laminas\ApiTools\ApiProblem\ApiProblem;
use Laminas\ApiTools\Rest\AbstractResourceListener;
use Laminas\Stdlib\Parameters;

class <?= $classname ?> extends AbstractResourceListener
{
    ...
    /**
     * Fetch all or a subset of resources
     *
     * @param  array|Parameters $params
     * @return ApiProblem|mixed
     */
    public function fetchAll($params = [])

Here's the PR fixing it : https://github.com/laminas-api-tools/api-tools-admin/pull/83

Thanks and greetings, Pascal

Ocramius commented 2 years ago

Handled in #83