summaryrefslogtreecommitdiff
path: root/app/Model/Task.php
diff options
context:
space:
mode:
authorFrédéric Guillot <fred@kanboard.net>2014-11-22 10:05:44 -0500
committerFrédéric Guillot <fred@kanboard.net>2014-11-22 10:05:44 -0500
commit15038cdb10f8c691edc7980fd1aed32dcbed3f9f (patch)
treeebdf873e5c65616c3fd36ea2c7a449da52a61877 /app/Model/Task.php
parent8f0e544cd91b24423951bbb5d3f3be0950a63abe (diff)
Move task creation to a seperate class
Diffstat (limited to 'app/Model/Task.php')
-rw-r--r--app/Model/Task.php53
1 files changed, 0 insertions, 53 deletions
diff --git a/app/Model/Task.php b/app/Model/Task.php
index 1b2a66cd..93914fba 100644
--- a/app/Model/Task.php
+++ b/app/Model/Task.php
@@ -54,30 +54,6 @@ class Task extends Base
}
/**
- * Prepare data before task creation
- *
- * @access public
- * @param array $values Form values
- */
- public function prepareCreation(array &$values)
- {
- $this->prepare($values);
-
- if (empty($values['column_id'])) {
- $values['column_id'] = $this->board->getFirstColumn($values['project_id']);
- }
-
- if (empty($values['color_id'])) {
- $colors = $this->color->getList();
- $values['color_id'] = key($colors);
- }
-
- $values['date_creation'] = time();
- $values['date_modification'] = $values['date_creation'];
- $values['position'] = $this->taskFinder->countByColumnId($values['project_id'], $values['column_id']) + 1;
- }
-
- /**
* Prepare data before task modification
*
* @access public
@@ -90,35 +66,6 @@ class Task extends Base
}
/**
- * Create a task
- *
- * @access public
- * @param array $values Form values
- * @return boolean|integer
- */
- public function create(array $values)
- {
- $this->db->startTransaction();
-
- $this->prepareCreation($values);
-
- if (! $this->db->table(self::TABLE)->save($values)) {
- $this->db->cancelTransaction();
- return false;
- }
-
- $task_id = $this->db->getConnection()->getLastId();
-
- $this->db->closeTransaction();
-
- // Trigger events
- $this->event->trigger(self::EVENT_CREATE_UPDATE, array('task_id' => $task_id) + $values);
- $this->event->trigger(self::EVENT_CREATE, array('task_id' => $task_id) + $values);
-
- return $task_id;
- }
-
- /**
* Update a task
*
* @access public