From 3fcc0cb9183f9ff32ce7a3c615258bcf53c385ed Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Sat, 2 Jul 2016 14:44:26 -0400 Subject: Handle tags and tasks move/duplication to another project --- app/Model/TaskTagModel.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'app/Model/TaskTagModel.php') diff --git a/app/Model/TaskTagModel.php b/app/Model/TaskTagModel.php index 2a08e867..0553cc6c 100644 --- a/app/Model/TaskTagModel.php +++ b/app/Model/TaskTagModel.php @@ -19,6 +19,23 @@ class TaskTagModel extends Base */ const TABLE = 'task_has_tags'; + /** + * Get all tags not available in a project + * + * @access public + * @param integer $task_id + * @param integer $project_id + * @return array + */ + public function getTagIdsByTaskNotAvailableInProject($task_id, $project_id) + { + return $this->db->table(TagModel::TABLE) + ->eq(self::TABLE.'.task_id', $task_id) + ->notIn(TagModel::TABLE.'.project_id', array(0, $project_id)) + ->join(self::TABLE, 'tag_id', 'id') + ->findAllByColumn(TagModel::TABLE.'.id'); + } + /** * Get all tags associated to a task * -- cgit v1.2.3