summaryrefslogtreecommitdiff
path: root/app/Model
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2015-06-27 00:00:43 -0400
committerFrederic Guillot <fred@kanboard.net>2015-06-27 00:00:43 -0400
commit1823430d13508fec5de39264bb4fe1224716def2 (patch)
treef911a412f1b8be2471bcb66c7fed8adf675c8d4a /app/Model
parent7a22f4c6d47a3e5d447ebeeef094092a4a4b0ad2 (diff)
PicoDb update
Diffstat (limited to 'app/Model')
-rw-r--r--app/Model/Action.php4
-rw-r--r--app/Model/Base.php2
-rw-r--r--app/Model/Category.php2
-rw-r--r--app/Model/Currency.php2
-rw-r--r--app/Model/File.php2
-rw-r--r--app/Model/Link.php4
-rw-r--r--app/Model/Project.php6
-rw-r--r--app/Model/ProjectDuplication.php2
-rw-r--r--app/Model/ProjectIntegration.php4
-rw-r--r--app/Model/ProjectPermission.php6
-rw-r--r--app/Model/Subtask.php2
-rw-r--r--app/Model/TaskFinder.php2
-rw-r--r--app/Model/TaskLink.php2
-rw-r--r--app/Model/User.php2
14 files changed, 21 insertions, 21 deletions
diff --git a/app/Model/Action.php b/app/Model/Action.php
index 4ede5661..d0607794 100644
--- a/app/Model/Action.php
+++ b/app/Model/Action.php
@@ -241,7 +241,7 @@ class Action extends Base
return false;
}
- $action_id = $this->db->getConnection()->getLastId();
+ $action_id = $this->db->getLastId();
foreach ($values['params'] as $param_name => $param_value) {
@@ -329,7 +329,7 @@ class Action extends Base
continue;
}
- $action_id = $this->db->getConnection()->getLastId();
+ $action_id = $this->db->getLastId();
if (! $this->duplicateParameters($dst_project_id, $action_id, $action['params'])) {
$this->container['logger']->debug('Action::duplicate => unable to copy parameters for '.$action['action_name']);
diff --git a/app/Model/Base.php b/app/Model/Base.php
index 51ae782d..973462cc 100644
--- a/app/Model/Base.php
+++ b/app/Model/Base.php
@@ -48,7 +48,7 @@ abstract class Base extends \Core\Base
return false;
}
- return (int) $db->getConnection()->getLastId();
+ return (int) $db->getLastId();
});
}
diff --git a/app/Model/Category.php b/app/Model/Category.php
index 9f93e7be..dcc0f88e 100644
--- a/app/Model/Category.php
+++ b/app/Model/Category.php
@@ -30,7 +30,7 @@ class Category extends Base
*/
public function exists($category_id, $project_id)
{
- return $this->db->table(self::TABLE)->eq('id', $category_id)->eq('project_id', $project_id)->count() > 0;
+ return $this->db->table(self::TABLE)->eq('id', $category_id)->eq('project_id', $project_id)->exists();
}
/**
diff --git a/app/Model/Currency.php b/app/Model/Currency.php
index 6ae842e7..d04df763 100644
--- a/app/Model/Currency.php
+++ b/app/Model/Currency.php
@@ -64,7 +64,7 @@ class Currency extends Base
*/
public function create($currency, $rate)
{
- if ($this->db->table(self::TABLE)->eq('currency', $currency)->count() === 1) {
+ if ($this->db->table(self::TABLE)->eq('currency', $currency)->exists()) {
return $this->update($currency, $rate);
}
diff --git a/app/Model/File.php b/app/Model/File.php
index 38b34cd3..3a44fee1 100644
--- a/app/Model/File.php
+++ b/app/Model/File.php
@@ -105,7 +105,7 @@ class File extends Base
new FileEvent(array('task_id' => $task_id, 'name' => $name))
);
- return (int) $this->db->getConnection()->getLastId();
+ return (int) $this->db->getLastId();
}
return false;
diff --git a/app/Model/Link.php b/app/Model/Link.php
index e0e5184e..467710bd 100644
--- a/app/Model/Link.php
+++ b/app/Model/Link.php
@@ -123,7 +123,7 @@ class Link extends Base
return false;
}
- $label_id = $this->db->getConnection()->getLastId();
+ $label_id = $this->db->getLastId();
if (! empty($opposite_label)) {
@@ -138,7 +138,7 @@ class Link extends Base
->table(self::TABLE)
->eq('id', $label_id)
->update(array(
- 'opposite_id' => $this->db->getConnection()->getLastId()
+ 'opposite_id' => $this->db->getLastId()
));
}
diff --git a/app/Model/Project.php b/app/Model/Project.php
index ef7340ee..3c864e5d 100644
--- a/app/Model/Project.php
+++ b/app/Model/Project.php
@@ -111,7 +111,7 @@ class Project extends Base
*/
public function isPrivate($project_id)
{
- return (bool) $this->db->table(self::TABLE)->eq('id', $project_id)->eq('is_private', 1)->count();
+ return $this->db->table(self::TABLE)->eq('id', $project_id)->eq('is_private', 1)->exists();
}
/**
@@ -305,7 +305,7 @@ class Project extends Base
return false;
}
- $project_id = $this->db->getConnection()->getLastId();
+ $project_id = $this->db->getLastId();
if (! $this->board->create($project_id, $this->board->getUserColumns())) {
$this->db->cancelTransaction();
@@ -391,7 +391,7 @@ class Project extends Base
*/
public function exists($project_id)
{
- return $this->db->table(self::TABLE)->eq('id', $project_id)->count() === 1;
+ return $this->db->table(self::TABLE)->eq('id', $project_id)->exists();
}
/**
diff --git a/app/Model/ProjectDuplication.php b/app/Model/ProjectDuplication.php
index 7e3407be..6e054a4b 100644
--- a/app/Model/ProjectDuplication.php
+++ b/app/Model/ProjectDuplication.php
@@ -53,7 +53,7 @@ class ProjectDuplication extends Base
return 0;
}
- return $this->db->getConnection()->getLastId();
+ return $this->db->getLastId();
}
/**
diff --git a/app/Model/ProjectIntegration.php b/app/Model/ProjectIntegration.php
index 98ff8d4c..bcbfeae5 100644
--- a/app/Model/ProjectIntegration.php
+++ b/app/Model/ProjectIntegration.php
@@ -39,7 +39,7 @@ class ProjectIntegration extends Base
*/
public function saveParameters($project_id, array $values)
{
- if ($this->db->table(self::TABLE)->eq('project_id', $project_id)->count() === 1) {
+ if ($this->db->table(self::TABLE)->eq('project_id', $project_id)->exists()) {
return $this->db->table(self::TABLE)->eq('project_id', $project_id)->update($values);
}
@@ -61,6 +61,6 @@ class ProjectIntegration extends Base
->table(self::TABLE)
->eq('project_id', $project_id)
->eq($option, $value)
- ->count() === 1;
+ ->exists();
}
}
diff --git a/app/Model/ProjectPermission.php b/app/Model/ProjectPermission.php
index b0a09df4..bc752dda 100644
--- a/app/Model/ProjectPermission.php
+++ b/app/Model/ProjectPermission.php
@@ -219,7 +219,7 @@ class ProjectPermission extends Base
->table(self::TABLE)
->eq('project_id', $project_id)
->eq('user_id', $user_id)
- ->count() === 1;
+ ->exists();
}
/**
@@ -237,7 +237,7 @@ class ProjectPermission extends Base
->eq('project_id', $project_id)
->eq('user_id', $user_id)
->eq('is_owner', 1)
- ->count() === 1;
+ ->exists();
}
/**
@@ -266,7 +266,7 @@ class ProjectPermission extends Base
->table(Project::TABLE)
->eq('id', $project_id)
->eq('is_everybody_allowed', 1)
- ->count() === 1;
+ ->exists();
}
/**
diff --git a/app/Model/Subtask.php b/app/Model/Subtask.php
index b9cc6ded..d8a44aff 100644
--- a/app/Model/Subtask.php
+++ b/app/Model/Subtask.php
@@ -390,7 +390,7 @@ class Subtask extends Base
$this->db->table(self::TABLE)
->eq('status', self::STATUS_INPROGRESS)
->eq('user_id', $user_id)
- ->count() === 1;
+ ->exists();
}
/**
diff --git a/app/Model/TaskFinder.php b/app/Model/TaskFinder.php
index ead60b4b..9c46f4a9 100644
--- a/app/Model/TaskFinder.php
+++ b/app/Model/TaskFinder.php
@@ -349,6 +349,6 @@ class TaskFinder extends Base
*/
public function exists($task_id)
{
- return $this->db->table(Task::TABLE)->eq('id', $task_id)->count() === 1;
+ return $this->db->table(Task::TABLE)->eq('id', $task_id)->exists();
}
}
diff --git a/app/Model/TaskLink.php b/app/Model/TaskLink.php
index 251460c9..435bd0e5 100644
--- a/app/Model/TaskLink.php
+++ b/app/Model/TaskLink.php
@@ -133,7 +133,7 @@ class TaskLink extends Base
'link_id' => $link_id,
));
- $task_link_id = $this->db->getConnection()->getLastId();
+ $task_link_id = $this->db->getLastId();
// Create the opposite task link
$this->db->table(self::TABLE)->insert(array(
diff --git a/app/Model/User.php b/app/Model/User.php
index 726978e5..63b49367 100644
--- a/app/Model/User.php
+++ b/app/Model/User.php
@@ -38,7 +38,7 @@ class User extends Base
*/
public function exists($user_id)
{
- return $this->db->table(self::TABLE)->eq('id', $user_id)->count() === 1;
+ return $this->db->table(self::TABLE)->eq('id', $user_id)->exists();
}
/**