summaryrefslogtreecommitdiff
path: root/app/Model
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2015-09-05 11:23:51 -0400
committerFrederic Guillot <fred@kanboard.net>2015-09-05 11:23:51 -0400
commitbac18d80f8ff8fce9d167671273e80a492f4c3c5 (patch)
treecdb950786eb3d8a92c7307695ce6680041b5a175 /app/Model
parent69c5c83d34229c92a6b9c38c225a81058ab94047 (diff)
parent42a3a56a91bbc6f1f8c913c8a990d9ea549d481b (diff)
Merge pull-request #1178
Diffstat (limited to 'app/Model')
-rw-r--r--app/Model/Swimlane.php28
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);
}
/**