diff options
Diffstat (limited to 'app/Model')
-rw-r--r-- | app/Model/Category.php | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/app/Model/Category.php b/app/Model/Category.php index 65fd0c56..54a0f552 100644 --- a/app/Model/Category.php +++ b/app/Model/Category.php @@ -165,26 +165,26 @@ class Category extends Base } /** - * Duplicate categories from a project to another one + * Duplicate categories from a project to another one, must be executed inside a transaction * * @author Antonio Rabelo - * @param integer $project_from Project Template - * @return integer $project_to Project that receives the copy + * @param integer $src_project_id Source project id + * @return integer $dst_project_id Destination project id * @return boolean */ - public function duplicate($project_from, $project_to) + public function duplicate($src_project_id, $dst_project_id) { $categories = $this->db->table(self::TABLE) ->columns('name') - ->eq('project_id', $project_from) + ->eq('project_id', $src_project_id) ->asc('name') ->findAll(); foreach ($categories as $category) { - $category['project_id'] = $project_to; + $category['project_id'] = $dst_project_id; - if (! $this->category->create($category)) { + if (! $this->db->table(self::TABLE)->save($category)) { return false; } } |