Sync: fail with missing key column

NB: might not work as expected, more fixes to come
This commit is contained in:
Thomas Gelf 2015-07-24 15:27:37 +02:00
parent e3f7af057f
commit 1c5f83a6cf
1 changed files with 7 additions and 0 deletions

View File

@ -64,6 +64,13 @@ class Sync
$key = $source->key_column;
$imported[$sourceId] = array();
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;
}
}