PicoDb update

This commit is contained in:
Frederic Guillot
2015-06-27 00:00:43 -04:00
parent 7a22f4c6d4
commit 1823430d13
18 changed files with 28 additions and 28 deletions

View File

@@ -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']);

View File

@@ -48,7 +48,7 @@ abstract class Base extends \Core\Base
return false;
}
return (int) $db->getConnection()->getLastId();
return (int) $db->getLastId();
});
}

View File

@@ -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();
}
/**

View File

@@ -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);
}

View File

@@ -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;

View File

@@ -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()
));
}

View File

@@ -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();
}
/**

View File

@@ -53,7 +53,7 @@ class ProjectDuplication extends Base
return 0;
}
return $this->db->getConnection()->getLastId();
return $this->db->getLastId();
}
/**

View File

@@ -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();
}
}

View File

@@ -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();
}
/**

View File

@@ -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();
}
/**

View File

@@ -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();
}
}

View File

@@ -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(

View File

@@ -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();
}
/**