diff options
author | Frederic Guillot <fred@kanboard.net> | 2015-09-05 11:23:51 -0400 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2015-09-05 11:23:51 -0400 |
commit | bac18d80f8ff8fce9d167671273e80a492f4c3c5 (patch) | |
tree | cdb950786eb3d8a92c7307695ce6680041b5a175 /app/Model | |
parent | 69c5c83d34229c92a6b9c38c225a81058ab94047 (diff) | |
parent | 42a3a56a91bbc6f1f8c913c8a990d9ea549d481b (diff) |
Merge pull-request #1178
Diffstat (limited to 'app/Model')
-rw-r--r-- | app/Model/Swimlane.php | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/app/Model/Swimlane.php b/app/Model/Swimlane.php index 3b78a406..06e879a4 100644 --- a/app/Model/Swimlane.php +++ b/app/Model/Swimlane.php @@ -160,7 +160,7 @@ class Swimlane extends Base public function getSwimlanes($project_id) { $swimlanes = $this->db->table(self::TABLE) - ->columns('id', 'name') + ->columns('id', 'name', 'description') ->eq('project_id', $project_id) ->eq('is_active', self::ACTIVE) ->orderBy('position', 'asc') @@ -216,32 +216,30 @@ class Swimlane extends Base * Add a new swimlane * * @access public - * @param integer $project_id - * @param string $name + * @param array $values Form values * @return integer|boolean */ - public function create($project_id, $name) + public function create($values) { - return $this->persist(self::TABLE, array( - 'project_id' => $project_id, - 'name' => $name, - 'position' => $this->getLastPosition($project_id), - )); + if (! $this->project->exists($values['project_id'])) { + return 0; + } + $values['position'] = $this->getLastPosition($values['project_id']); + return $this->persist(self::TABLE, $values); } /** - * Rename a swimlane + * Update a swimlane * * @access public - * @param integer $swimlane_id Swimlane id - * @param string $name Swimlane name + * @param array $values Form values * @return bool */ - public function rename($swimlane_id, $name) + public function update(array $values) { return $this->db->table(self::TABLE) - ->eq('id', $swimlane_id) - ->update(array('name' => $name)); + ->eq('id', $values['id']) + ->update($values); } /** |