From 8079b5af64fbebd14a3a0e470bc48bcb4a9bade3 Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Sun, 20 Sep 2015 11:21:14 -0400 Subject: Fix Mysql error about gitlab_id when creating remote user --- app/Model/Base.php | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'app/Model/Base.php') diff --git a/app/Model/Base.php b/app/Model/Base.php index 973462cc..e700f326 100644 --- a/app/Model/Base.php +++ b/app/Model/Base.php @@ -62,14 +62,30 @@ abstract class Base extends \Core\Base public function removeFields(array &$values, array $keys) { foreach ($keys as $key) { - if (isset($values[$key])) { + if (array_key_exists($key, $values)) { + unset($values[$key]); + } + } + } + + /** + * Remove keys from an array if empty + * + * @access public + * @param array $values Input array + * @param string[] $keys List of keys to remove + */ + public function removeEmptyFields(array &$values, array $keys) + { + foreach ($keys as $key) { + if (array_key_exists($key, $values) && empty($values[$key])) { unset($values[$key]); } } } /** - * Force some fields to be at 0 if empty + * Force fields to be at 0 if empty * * @access public * @param array $values Input array -- cgit v1.2.3