diff options
author | Frédéric Guillot <fred@kanboard.net> | 2014-12-31 14:15:42 -0500 |
---|---|---|
committer | Frédéric Guillot <fred@kanboard.net> | 2014-12-31 14:15:42 -0500 |
commit | ee8ec7685f95125c385d17dad41369a549ce9bbf (patch) | |
tree | 9964c7e5e46f4c8421e90a2a2a272cd3aea10975 /app/Model/Action.php | |
parent | 27f453707948daf08e4a38c4c22e637a7ad0c57d (diff) |
Reduce the number of SQL queries for automatic actions
Diffstat (limited to 'app/Model/Action.php')
-rw-r--r-- | app/Model/Action.php | 10 |
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; |