summaryrefslogtreecommitdiff
path: root/app/Model/ProjectModel.php
diff options
context:
space:
mode:
Diffstat (limited to 'app/Model/ProjectModel.php')
-rw-r--r--app/Model/ProjectModel.php21
1 files changed, 13 insertions, 8 deletions
diff --git a/app/Model/ProjectModel.php b/app/Model/ProjectModel.php
index 7f9cfb9b..a4d75a0b 100644
--- a/app/Model/ProjectModel.php
+++ b/app/Model/ProjectModel.php
@@ -321,19 +321,19 @@ class ProjectModel extends Base
* Create a project
*
* @access public
- * @param array $values Form values
- * @param integer $user_id User who create the project
- * @param bool $add_user Automatically add the user
- * @return integer Project id
+ * @param array $values Form values
+ * @param integer $userId User who create the project
+ * @param bool $addUser Automatically add the user
+ * @return int Project id
*/
- public function create(array $values, $user_id = 0, $add_user = false)
+ public function create(array $values, $userId = 0, $addUser = false)
{
$this->db->startTransaction();
$values['token'] = '';
$values['last_modified'] = time();
$values['is_private'] = empty($values['is_private']) ? 0 : 1;
- $values['owner_id'] = $user_id;
+ $values['owner_id'] = $userId;
if (! empty($values['identifier'])) {
$values['identifier'] = strtoupper($values['identifier']);
@@ -353,8 +353,13 @@ class ProjectModel extends Base
return false;
}
- if ($add_user && $user_id) {
- $this->projectUserRoleModel->addUser($project_id, $user_id, Role::PROJECT_MANAGER);
+ if (! $this->swimlaneModel->create($project_id, t('Default swimlane'))) {
+ $this->db->cancelTransaction();
+ return false;
+ }
+
+ if ($addUser && $userId) {
+ $this->projectUserRoleModel->addUser($project_id, $userId, Role::PROJECT_MANAGER);
}
$this->categoryModel->createDefaultCategories($project_id);