summaryrefslogtreecommitdiff
path: root/app/Model/ProjectMetadata.php
diff options
context:
space:
mode:
authorBusfreak <Busfreak@users.noreply.github.com>2016-05-12 00:26:44 +0200
committerFrédéric Guillot <fred@kanboard.net>2016-05-11 18:26:44 -0400
commit58ccf9f6929512bc5ccba16279eacde3e9dc537e (patch)
tree08f2a144cef03cfa8232c1b374684598a8be781b /app/Model/ProjectMetadata.php
parent754b2bf1f0f833464c19c96c82bdc70d4d2d9c77 (diff)
Duplicate project metadata when duplicating project (#2074)
Diffstat (limited to 'app/Model/ProjectMetadata.php')
-rw-r--r--app/Model/ProjectMetadata.php19
1 files changed, 19 insertions, 0 deletions
diff --git a/app/Model/ProjectMetadata.php b/app/Model/ProjectMetadata.php
index 85498053..256f5e1f 100644
--- a/app/Model/ProjectMetadata.php
+++ b/app/Model/ProjectMetadata.php
@@ -27,4 +27,23 @@ class ProjectMetadata extends Metadata
{
return 'project_id';
}
+
+ /**
+ * Helper method to duplicate all metadata to another project
+ *
+ * @access public
+ * @param integer $src_project_id
+ * @param integer $dst_project_id
+ * @return boolean
+ */
+ public function duplicate($src_project_id, $dst_project_id)
+ {
+ $metadata = $this->getAll($src_project_id);
+
+ if (! $this->save($dst_project_id, $metadata)) {
+ return false;
+ }
+
+ return true;
+ }
}