Import/Sync: add support for 'import' fields
This commit is contained in:
parent
c26f2ed087
commit
19eec671f2
|
@ -90,6 +90,7 @@ class Sync
|
|||
);
|
||||
|
||||
$newVars = array();
|
||||
$imports = array();
|
||||
|
||||
foreach ($properties as $p) {
|
||||
if ($p->source_id !== $sourceId) continue;
|
||||
|
@ -100,7 +101,11 @@ class Sync
|
|||
if (substr($prop, 0, 5) === 'vars.') {
|
||||
$newVars[substr($prop, 5)] = $val;
|
||||
} else {
|
||||
$newProps[$prop] = $val;
|
||||
if ($prop === 'import') {
|
||||
$imports[] = $val;
|
||||
} else {
|
||||
$newProps[$prop] = $val;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -111,6 +116,9 @@ class Sync
|
|||
foreach ($newVars as $prop => $var) {
|
||||
$objects[$key]->vars()->$prop = $var;
|
||||
}
|
||||
if (! empty($imports)) {
|
||||
$objects[$key]->imports()->set($imports);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'merge':
|
||||
|
@ -123,6 +131,10 @@ class Sync
|
|||
// TODO: property merge policy
|
||||
$object->vars()->$prop = $var;
|
||||
}
|
||||
if (! empty($imports)) {
|
||||
// TODO: merge imports ?!
|
||||
$objects[$key]->imports()->set($imports);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
Loading…
Reference in New Issue