summaryrefslogtreecommitdiff
path: root/app/Model
diff options
context:
space:
mode:
authorFrédéric Guillot <fred@kanboard.net>2018-10-02 15:15:23 -0700
committerFrédéric Guillot <fred@kanboard.net>2018-10-02 15:15:23 -0700
commitc06a1108304eb31d15523fcd3caf78509eefd841 (patch)
tree768af86802bd5a4ec9c69768d761ee4f0cce52be /app/Model
parent5cce000f9560d52a7f2444f9f8b46c2a9e7750cf (diff)
Reduce number of SQL queries when doing groups sync
Diffstat (limited to 'app/Model')
-rw-r--r--app/Model/GroupModel.php20
1 files changed, 18 insertions, 2 deletions
diff --git a/app/Model/GroupModel.php b/app/Model/GroupModel.php
index 5acf7e3f..ca15d409 100644
--- a/app/Model/GroupModel.php
+++ b/app/Model/GroupModel.php
@@ -45,10 +45,10 @@ class GroupModel extends Base
}
/**
- * Get a specific group by external id
+ * Get a specific group by externalID
*
* @access public
- * @param integer $external_id
+ * @param string $external_id
* @return array
*/
public function getByExternalId($external_id)
@@ -57,6 +57,22 @@ class GroupModel extends Base
}
/**
+ * Get specific groups by externalIDs
+ *
+ * @access public
+ * @param string[] $external_ids
+ * @return array
+ */
+ public function getByExternalIds(array $external_ids)
+ {
+ if (empty($external_ids)) {
+ return [];
+ }
+
+ return $this->db->table(self::TABLE)->in('external_id', $external_ids)->findAll();
+ }
+
+ /**
* Get all groups
*
* @access public