Sync: fail with missing key column
NB: might not work as expected, more fixes to come
This commit is contained in:
parent
e3f7af057f
commit
1c5f83a6cf
|
@ -64,6 +64,13 @@ class Sync
|
||||||
$key = $source->key_column;
|
$key = $source->key_column;
|
||||||
$imported[$sourceId] = array();
|
$imported[$sourceId] = array();
|
||||||
foreach ($rows as $row) {
|
foreach ($rows as $row) {
|
||||||
|
if (! property_exists($row, $key)) {
|
||||||
|
throw new \Exception(
|
||||||
|
sprintf(
|
||||||
|
'There is no key column "%s" in this row from "%s": %s', $key, $source->source_name, json_encode($row)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
$imported[$sourceId][$row->$key] = $row;
|
$imported[$sourceId][$row->$key] = $row;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue