summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorFrédéric Guillot <fred@kanboard.net>2014-12-31 14:15:42 -0500
committerFrédéric Guillot <fred@kanboard.net>2014-12-31 14:15:42 -0500
commitee8ec7685f95125c385d17dad41369a549ce9bbf (patch)
tree9964c7e5e46f4c8421e90a2a2a272cd3aea10975 /app
parent27f453707948daf08e4a38c4c22e637a7ad0c57d (diff)
Reduce the number of SQL queries for automatic actions
Diffstat (limited to 'app')
-rw-r--r--app/Model/Action.php10
1 files changed, 9 insertions, 1 deletions
diff --git a/app/Model/Action.php b/app/Model/Action.php
index 905b8914..95e22d27 100644
--- a/app/Model/Action.php
+++ b/app/Model/Action.php
@@ -140,9 +140,17 @@ class Action extends Base
public function getAll()
{
$actions = $this->db->table(self::TABLE)->findAll();
+ $params = $this->db->table(self::TABLE_PARAMS)->findAll();
foreach ($actions as &$action) {
- $action['params'] = $this->db->table(self::TABLE_PARAMS)->eq('action_id', $action['id'])->findAll();
+
+ $action['params'] = array();
+
+ foreach ($params as $param) {
+ if ($param['action_id'] === $action['id']) {
+ $action['params'][] = $param;
+ }
+ }
}
return $actions;