From a45b8ddc55dc88ddfc930867660338cd8fec57b6 Mon Sep 17 00:00:00 2001 From: Tom H Anderson Date: Mon, 19 Mar 2018 16:39:35 -0600 Subject: [PATCH] Minimum changes for corrected zf-configuration --- src/Model/ContentNegotiationModel.php | 2 +- src/Model/RestServiceModel.php | 10 +++++----- src/Model/RpcServiceModel.php | 2 +- test/Model/DbAdapterModelTest.php | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Model/ContentNegotiationModel.php b/src/Model/ContentNegotiationModel.php index 6c7e6979..a5299e45 100644 --- a/src/Model/ContentNegotiationModel.php +++ b/src/Model/ContentNegotiationModel.php @@ -33,7 +33,7 @@ public function __construct(ConfigResource $globalConfig) public function create($name, array $contentConfig) { $key = 'zf-content-negotiation.selectors.' . $name; - $this->globalConfig->patchKey($key, $contentConfig); + $this->globalConfig->replaceKey($key, $contentConfig); return new ContentNegotiationEntity($name, $contentConfig); } diff --git a/src/Model/RestServiceModel.php b/src/Model/RestServiceModel.php index 0da49099..3854010f 100644 --- a/src/Model/RestServiceModel.php +++ b/src/Model/RestServiceModel.php @@ -830,7 +830,7 @@ public function updateRestConfig(RestServiceEntity $original, RestServiceEntity foreach ($this->restArrayUpdateOptions as $property => $configKey) { $key = sprintf('zf-rest.%s.%s', $original->controllerServiceName, $configKey); - $this->configResource->patchKey($key, $update->$property); + $this->configResource->replaceKey($key, $update->$property); } } @@ -847,7 +847,7 @@ public function updateContentNegotiationConfig(RestServiceEntity $original, Rest if ($update->selector) { $key = $baseKey . 'controllers.' . $service; - $this->configResource->patchKey($key, $update->selector); + $this->configResource->replaceKey($key, $update->selector); } // Array dereferencing is a PITA @@ -856,7 +856,7 @@ public function updateContentNegotiationConfig(RestServiceEntity $original, Rest && ! empty($acceptWhitelist) ) { $key = $baseKey . 'accept_whitelist.' . $service; - $this->configResource->patchKey($key, $acceptWhitelist); + $this->configResource->replaceKey($key, $acceptWhitelist); } $contentTypeWhitelist = $update->contentTypeWhitelist; @@ -864,7 +864,7 @@ public function updateContentNegotiationConfig(RestServiceEntity $original, Rest && ! empty($contentTypeWhitelist) ) { $key = $baseKey . 'content_type_whitelist.' . $service; - $this->configResource->patchKey($key, $contentTypeWhitelist); + $this->configResource->replaceKey($key, $contentTypeWhitelist); } } @@ -1086,7 +1086,7 @@ public function deleteVersioningConfig(RestServiceEntity $entity) }); $key = ['zf-versioning', 'uri']; - $this->configResource->patchKey($key, $versioning); + $this->configResource->replaceKey($key, $versioning); } /** diff --git a/src/Model/RpcServiceModel.php b/src/Model/RpcServiceModel.php index 840b778e..c514dfcd 100644 --- a/src/Model/RpcServiceModel.php +++ b/src/Model/RpcServiceModel.php @@ -623,7 +623,7 @@ public function deleteVersioningConfig($routeName, $serviceName) }); $key = ['zf-versioning', 'uri']; - $this->configResource->patchKey($key, $versioning); + $this->configResource->replaceKey($key, $versioning); } /** diff --git a/test/Model/DbAdapterModelTest.php b/test/Model/DbAdapterModelTest.php index 76b623cd..75e1b6eb 100644 --- a/test/Model/DbAdapterModelTest.php +++ b/test/Model/DbAdapterModelTest.php @@ -151,7 +151,7 @@ public function testCreatesNewEntriesInBothGlobalAndLocalDbConfigWhenConfigExist $model->create('Db\New', ['driver' => 'Pdo_Sqlite', 'database' => __FILE__]); $global = include $this->globalConfigPath; - $this->assertDbConfigEquals([], 'Db\Old', $global); + $this->assertDbConfigEquals($localSeedConfig['db']['adapters']['Db\Old'], 'Db\Old', $global); $this->assertDbConfigEquals([], 'Db\New', $global); $local = include $this->localConfigPath;