SyncRule: Support hasCombinedKey for serviceSet

refs #12891
This commit is contained in:
Markus Frosch 2016-11-09 10:42:56 +01:00
parent b051b2da17
commit 39538a3f33
1 changed files with 23 additions and 0 deletions

View File

@ -272,6 +272,29 @@ class SyncRule extends DbObject
}
}
if ($hasHost !== false && $hasObjectName !== false) {
$this->hasCombinedKey = true;
$this->sourceKeyPattern = sprintf(
'%s!%s',
$hasHost,
$hasObjectName
);
$this->destinationKeyPattern = '${host}!${object_name}';
}
} elseif ($this->get('object_type') === 'serviceSet') {
$hasHost = false;
$hasObjectName = false;
foreach ($this->getSyncProperties() as $key => $property) {
if ($property->destination_field === 'host') {
$hasHost = $property->source_expression;
}
if ($property->destination_field === 'object_name') {
$hasObjectName = $property->source_expression;
}
}
if ($hasHost !== false && $hasObjectName !== false) {
$this->hasCombinedKey = true;
$this->sourceKeyPattern = sprintf(