From 1c5f83a6cfe45f179064f42192cef59ac5b2f1cf Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Fri, 24 Jul 2015 15:27:37 +0200 Subject: [PATCH] Sync: fail with missing key column NB: might not work as expected, more fixes to come --- library/Director/Import/Sync.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/library/Director/Import/Sync.php b/library/Director/Import/Sync.php index 7d0ce810..5a29e2ed 100644 --- a/library/Director/Import/Sync.php +++ b/library/Director/Import/Sync.php @@ -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; } }