summaryrefslogtreecommitdiff
path: root/app/Model
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2017-05-12 16:26:11 -0400
committerFrederic Guillot <fred@kanboard.net>2017-05-12 16:26:11 -0400
commit3cf9484644dc5002b396eb31a2065456ce0de5b7 (patch)
tree65ca672cb7d8cf5510531b2eb87c24ec5b6fb798 /app/Model
parent5b7e137f769e352e0dddeff6c0c9a19602a8e4d9 (diff)
Ensure project tags are removed when the project is removed (PR #3250)
Diffstat (limited to 'app/Model')
-rw-r--r--app/Model/ProjectModel.php8
1 files changed, 7 insertions, 1 deletions
diff --git a/app/Model/ProjectModel.php b/app/Model/ProjectModel.php
index 7f489c75..7f55a9fb 100644
--- a/app/Model/ProjectModel.php
+++ b/app/Model/ProjectModel.php
@@ -462,7 +462,13 @@ class ProjectModel extends Base
*/
public function remove($project_id)
{
- return $this->db->table(self::TABLE)->eq('id', $project_id)->remove();
+ $this->db->startTransaction();
+
+ $this->db->table(TagModel::TABLE)->eq('project_id', $project_id)->remove();
+ $result = $this->db->table(self::TABLE)->eq('id', $project_id)->remove();
+
+ $this->db->closeTransaction();
+ return $result;
}
/**