Cosmetic fixes
This commit is contained in:
parent
7303a79b50
commit
039baacaa0
|
|
@ -22,4 +22,4 @@ before_script:
|
||||||
- php -i
|
- php -i
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- phpunit -c tests/units.$DB.xml
|
- phpunit -c tests/units.$DB.xml
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
namespace Kanboard\Model;
|
namespace Kanboard\Model;
|
||||||
|
|
||||||
|
use PicoDb\Database;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base model class
|
* Base model class
|
||||||
*
|
*
|
||||||
|
|
@ -20,7 +22,7 @@ abstract class Base extends \Kanboard\Core\Base
|
||||||
*/
|
*/
|
||||||
public function persist($table, array $values)
|
public function persist($table, array $values)
|
||||||
{
|
{
|
||||||
return $this->db->transaction(function ($db) use ($table, $values) {
|
return $this->db->transaction(function (Database $db) use ($table, $values) {
|
||||||
|
|
||||||
if (! $db->table($table)->save($values)) {
|
if (! $db->table($table)->save($values)) {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ namespace Kanboard\Model;
|
||||||
|
|
||||||
use SimpleValidator\Validator;
|
use SimpleValidator\Validator;
|
||||||
use SimpleValidator\Validators;
|
use SimpleValidator\Validators;
|
||||||
|
use PicoDb\Database;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Board model
|
* Board model
|
||||||
|
|
@ -173,7 +174,7 @@ class Board extends Base
|
||||||
*/
|
*/
|
||||||
public function saveColumnPositions(array $columns)
|
public function saveColumnPositions(array $columns)
|
||||||
{
|
{
|
||||||
return $this->db->transaction(function ($db) use ($columns) {
|
return $this->db->transaction(function (Database $db) use ($columns) {
|
||||||
|
|
||||||
foreach ($columns as $column_id => $position) {
|
foreach ($columns as $column_id => $position) {
|
||||||
if (! $db->table(Board::TABLE)->eq('id', $column_id)->update(array('position' => $position))) {
|
if (! $db->table(Board::TABLE)->eq('id', $column_id)->update(array('position' => $position))) {
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
namespace Kanboard\Model;
|
namespace Kanboard\Model;
|
||||||
|
|
||||||
|
use use PicoDb\Database;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Project Daily Stats
|
* Project Daily Stats
|
||||||
*
|
*
|
||||||
|
|
@ -29,7 +31,7 @@ class ProjectDailyStats extends Base
|
||||||
{
|
{
|
||||||
$lead_cycle_time = $this->projectAnalytic->getAverageLeadAndCycleTime($project_id);
|
$lead_cycle_time = $this->projectAnalytic->getAverageLeadAndCycleTime($project_id);
|
||||||
|
|
||||||
return $this->db->transaction(function ($db) use ($project_id, $date, $lead_cycle_time) {
|
return $this->db->transaction(function (Database $db) use ($project_id, $date, $lead_cycle_time) {
|
||||||
|
|
||||||
// This call will fail if the record already exists
|
// This call will fail if the record already exists
|
||||||
// (cross database driver hack for INSERT..ON DUPLICATE KEY UPDATE)
|
// (cross database driver hack for INSERT..ON DUPLICATE KEY UPDATE)
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
namespace Kanboard\Model;
|
namespace Kanboard\Model;
|
||||||
|
|
||||||
|
use PicoDb\Database;
|
||||||
use Kanboard\Event\SubtaskEvent;
|
use Kanboard\Event\SubtaskEvent;
|
||||||
use SimpleValidator\Validator;
|
use SimpleValidator\Validator;
|
||||||
use SimpleValidator\Validators;
|
use SimpleValidator\Validators;
|
||||||
|
|
@ -293,7 +294,7 @@ class Subtask extends Base
|
||||||
*/
|
*/
|
||||||
public function savePositions(array $subtasks)
|
public function savePositions(array $subtasks)
|
||||||
{
|
{
|
||||||
return $this->db->transaction(function ($db) use ($subtasks) {
|
return $this->db->transaction(function (Database $db) use ($subtasks) {
|
||||||
|
|
||||||
foreach ($subtasks as $subtask_id => $position) {
|
foreach ($subtasks as $subtask_id => $position) {
|
||||||
if (! $db->table(Subtask::TABLE)->eq('id', $subtask_id)->update(array('position' => $position))) {
|
if (! $db->table(Subtask::TABLE)->eq('id', $subtask_id)->update(array('position' => $position))) {
|
||||||
|
|
@ -433,7 +434,7 @@ class Subtask extends Base
|
||||||
*/
|
*/
|
||||||
public function duplicate($src_task_id, $dst_task_id)
|
public function duplicate($src_task_id, $dst_task_id)
|
||||||
{
|
{
|
||||||
return $this->db->transaction(function ($db) use ($src_task_id, $dst_task_id) {
|
return $this->db->transaction(function (Database $db) use ($src_task_id, $dst_task_id) {
|
||||||
|
|
||||||
$subtasks = $db->table(Subtask::TABLE)
|
$subtasks = $db->table(Subtask::TABLE)
|
||||||
->columns('title', 'time_estimated', 'position')
|
->columns('title', 'time_estimated', 'position')
|
||||||
|
|
|
||||||
|
|
@ -1,2 +1,2 @@
|
||||||
*
|
*
|
||||||
!/.gitignore
|
!/.gitignore
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue