summaryrefslogtreecommitdiff
path: root/app/Model/Base.php
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2015-09-20 11:21:14 -0400
committerFrederic Guillot <fred@kanboard.net>2015-09-20 11:21:14 -0400
commit8079b5af64fbebd14a3a0e470bc48bcb4a9bade3 (patch)
tree74da6e544529a4d74b5fdbf3ab854e43809eeb10 /app/Model/Base.php
parentd019eb4d2f193c7daea8ae0b098a0eb25084a975 (diff)
Fix Mysql error about gitlab_id when creating remote user
Diffstat (limited to 'app/Model/Base.php')
-rw-r--r--app/Model/Base.php20
1 files changed, 18 insertions, 2 deletions
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