Skip to content
This repository has been archived by the owner on Jan 21, 2020. It is now read-only.

[wip] zf-configuration patchKey fix #390

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion src/Model/ContentNegotiationModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
10 changes: 5 additions & 5 deletions src/Model/RestServiceModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand All @@ -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
Expand All @@ -856,15 +856,15 @@ 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;
if (is_array($contentTypeWhitelist)
&& ! empty($contentTypeWhitelist)
) {
$key = $baseKey . 'content_type_whitelist.' . $service;
$this->configResource->patchKey($key, $contentTypeWhitelist);
$this->configResource->replaceKey($key, $contentTypeWhitelist);
}
}

Expand Down Expand Up @@ -1086,7 +1086,7 @@ public function deleteVersioningConfig(RestServiceEntity $entity)
});

$key = ['zf-versioning', 'uri'];
$this->configResource->patchKey($key, $versioning);
$this->configResource->replaceKey($key, $versioning);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Model/RpcServiceModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,7 @@ public function deleteVersioningConfig($routeName, $serviceName)
});

$key = ['zf-versioning', 'uri'];
$this->configResource->patchKey($key, $versioning);
$this->configResource->replaceKey($key, $versioning);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion test/Model/DbAdapterModelTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down