From 98740875246862efe19e95866ccabd88dd9b88bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bruno=20=C5=A0kvorc?= Date: Sat, 12 Mar 2016 13:59:06 +0100 Subject: [PATCH] Update Mysql.php I ran into this issue quite a lot when doing upserting - turns out "groups" as a "column" can only be defined during registration, and subsequently only with `addGroup`. If this warning had been here, I would have realized what was to matter with the code much sooner. --- src/Psecio/Gatekeeper/DataSource/Mysql.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Psecio/Gatekeeper/DataSource/Mysql.php b/src/Psecio/Gatekeeper/DataSource/Mysql.php index 07ec6d8..77b0c32 100644 --- a/src/Psecio/Gatekeeper/DataSource/Mysql.php +++ b/src/Psecio/Gatekeeper/DataSource/Mysql.php @@ -145,6 +145,9 @@ public function update(\Modler\Model $model) $properties = $model->getProperties(); foreach ($bind as $column => $name) { + if (!isset($properties[$column]['column'])) { + throw new \InvalidArgumentException('Column "'.$column. '" is not defined!'); + } $colName = $properties[$column]['column']; $update[] = $colName.' = '.$name; }