summaryrefslogtreecommitdiff
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
parent7a22f4c6d47a3e5d447ebeeef094092a4a4b0ad2 (diff)
PicoDb update
-rw-r--r--app/Controller/Base.php2
-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
-rw-r--r--app/ServiceProvider/DatabaseProvider.php2
-rw-r--r--composer.lock8
-rw-r--r--tests/units/Base.php2
18 files changed, 28 insertions, 28 deletions
diff --git a/app/Controller/Base.php b/app/Controller/Base.php
index 19bb9ac9..cab70c6b 100644
--- a/app/Controller/Base.php
+++ b/app/Controller/Base.php
@@ -65,7 +65,7 @@ abstract class Base extends \Core\Base
$this->container['logger']->debug($message);
}
- $this->container['logger']->debug('SQL_QUERIES={nb}', array('nb' => $this->container['db']->nb_queries));
+ $this->container['logger']->debug('SQL_QUERIES={nb}', array('nb' => $this->container['db']->nbQueries));
$this->container['logger']->debug('RENDERING={time}', array('time' => microtime(true) - @$_SERVER['REQUEST_TIME_FLOAT']));
$this->container['logger']->debug('END_REQUEST='.$_SERVER['REQUEST_URI']);
}
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();
}
/**
diff --git a/app/ServiceProvider/DatabaseProvider.php b/app/ServiceProvider/DatabaseProvider.php
index e6a75a4e..8300fe7d 100644
--- a/app/ServiceProvider/DatabaseProvider.php
+++ b/app/ServiceProvider/DatabaseProvider.php
@@ -12,7 +12,7 @@ class DatabaseProvider implements ServiceProviderInterface
{
$container['db'] = $this->getInstance();
$container['db']->stopwatch = DEBUG;
- $container['db']->log_queries = DEBUG;
+ $container['db']->logQueries = DEBUG;
}
/**
diff --git a/composer.lock b/composer.lock
index 30831d9f..2c62762a 100644
--- a/composer.lock
+++ b/composer.lock
@@ -301,12 +301,12 @@
"source": {
"type": "git",
"url": "https://github.com/fguillot/picoDb.git",
- "reference": "dd08649713c9d8330b3c5fa23220a11cb5da3e79"
+ "reference": "e56c9d0f944bd768dc7c75e6726f7e811f114415"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/fguillot/picoDb/zipball/dd08649713c9d8330b3c5fa23220a11cb5da3e79",
- "reference": "dd08649713c9d8330b3c5fa23220a11cb5da3e79",
+ "url": "https://api.github.com/repos/fguillot/picoDb/zipball/e56c9d0f944bd768dc7c75e6726f7e811f114415",
+ "reference": "e56c9d0f944bd768dc7c75e6726f7e811f114415",
"shasum": ""
},
"require": {
@@ -330,7 +330,7 @@
],
"description": "Minimalist database query builder",
"homepage": "https://github.com/fguillot/picoDb",
- "time": "2015-06-24 21:58:15"
+ "time": "2015-06-27 03:51:24"
},
{
"name": "fguillot/simple-validator",
diff --git a/tests/units/Base.php b/tests/units/Base.php
index 1bbd62f8..7ad4e626 100644
--- a/tests/units/Base.php
+++ b/tests/units/Base.php
@@ -80,7 +80,7 @@ abstract class Base extends PHPUnit_Framework_TestCase
new Stopwatch
);
- $this->container['db']->log_queries = true;
+ $this->container['db']->logQueries = true;
$this->container['logger'] = new Logger;
$this->container['logger']->setLogger(new File('/dev/null'));