PicoDb update
This commit is contained in:
parent
7a22f4c6d4
commit
1823430d13
|
|
@ -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']);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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']);
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ abstract class Base extends \Core\Base
|
|||
return false;
|
||||
}
|
||||
|
||||
return (int) $db->getConnection()->getLastId();
|
||||
return (int) $db->getLastId();
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ class ProjectDuplication extends Base
|
|||
return 0;
|
||||
}
|
||||
|
||||
return $this->db->getConnection()->getLastId();
|
||||
return $this->db->getLastId();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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(
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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'));
|
||||
|
|
|
|||
Loading…
Reference in New Issue