Skip to content

Commit 8d4e8e7

Browse files
committed
Merge branch 'hotfix/9'
Close #9
2 parents 80ae1e1 + 210c771 commit 8d4e8e7

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

config/module.config.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
'zf-api-problem' => array(
3131
// Accept types that should allow ApiProblem responses
32-
// 'accept_filter' => $stringOrArray,
32+
// 'accept_filters' => $stringOrArray,
3333

3434
// Array of controller service names that should enable the ApiProblem render.error listener
3535
//'render_error_controllers' => array(),

docs/ref/api-problem-listener.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ This latter bit, the ``Accept`` header matching, is configurable. If you want to
5050
allow an API-Problem response for other than the default set of mediatypes
5151
(``application/hal+json``, ``application/api-problem+json``, and
5252
``application/json``), you can do so via your configuration. Set the value in
53-
the ``accept_filter`` subkey of the ``zf-hal`` configuration; the value
53+
the ``accept_filters`` subkey of the ``zf-hal`` configuration; the value
5454
should be a comma-separated set of mimetypes.
5555

5656
.. code-block:: php
@@ -59,7 +59,7 @@ should be a comma-separated set of mimetypes.
5959
return array(
6060
'zf-hal' => array(
6161
// ...
62-
'accept_filter' => 'application/json,text/json',
62+
'accept_filters' => 'application/json,text/json',
6363
),
6464
);
6565

src/ZF/ApiProblem/Factory/ApiProblemListenerFactory.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,14 @@ class ApiProblemListenerFactory implements FactoryInterface
1818
*/
1919
public function createService(ServiceLocatorInterface $serviceLocator)
2020
{
21-
$config = $serviceLocator->has('Config');
2221
$filters = null;
22+
$config = [];
2323

24-
if (isset($config['zf-api-problem'])
25-
&& isset($config['zf-api-problem']['accept_filters'])
26-
) {
24+
if ($serviceLocator->has('Config')) {
25+
$config = $serviceLocator->get('Config');
26+
}
27+
28+
if (isset($config['zf-api-problem']['accept_filters'])) {
2729
$filters = $config['zf-api-problem']['accept_filters'];
2830
}
2931

0 commit comments

Comments
 (0)