Skip to content

Commit f5f9ff2

Browse files
committed
Merge default config earlier so we can check for non-resource config options
resolves #69
1 parent a38e5e9 commit f5f9ff2

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
## Unreleased
44

5+
### Changed
6+
- It’s now possible to set `cache`, `serializer`, `jsonOptions`, `pretty`, `includes`, and `excludes` endpoint config options in the `defaults` array.
7+
58
## 2.5.3 - 2018-06-20
69

710
### Changed

src/Plugin.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,6 @@ public function createResource($config): ResourceInterface
9797
return $config->getResource();
9898
}
9999

100-
// Merge in the defaults
101-
$config = array_merge($this->getDefaultResourceAdapterConfig(), $config);
102-
103100
if (!isset($config['class'])) {
104101
// Default to ElementResourceAdapter
105102
$config['class'] = ElementResource::class;

src/controllers/DefaultController.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,11 @@ public function actionIndex(string $pattern): Response
8383
$config = $this->_callWithParams($config, $params);
8484
}
8585

86+
if (is_array($config)) {
87+
// Merge in the defaults
88+
$config = array_merge($plugin->getDefaultResourceAdapterConfig(), $config);
89+
}
90+
8691
// Before anything else, check the cache
8792
$cache = ArrayHelper::remove($config, 'cache', false);
8893

0 commit comments

Comments
 (0)