Rename subtask model

This commit is contained in:
Frederic Guillot
2015-02-07 18:36:16 -05:00
parent f83fc5bee4
commit fa6d19928a
20 changed files with 69 additions and 69 deletions

View File

@@ -2,7 +2,7 @@
namespace Controller; namespace Controller;
use Model\SubTask as SubTaskModel; use Model\Subtask as SubTaskModel;
/** /**
* Application controller * Application controller
@@ -55,7 +55,7 @@ class App extends Base
->setUrl('app', $action, array('pagination' => 'subtasks')) ->setUrl('app', $action, array('pagination' => 'subtasks'))
->setMax(10) ->setMax(10)
->setOrder('tasks.id') ->setOrder('tasks.id')
->setQuery($this->subTask->getUserQuery($user_id, $status)) ->setQuery($this->subtask->getUserQuery($user_id, $status))
->calculateOnlyIf($this->request->getStringParam('pagination') === 'subtasks'); ->calculateOnlyIf($this->request->getStringParam('pagination') === 'subtasks');
$project_paginator = $this->paginator $project_paginator = $this->paginator

View File

@@ -40,7 +40,7 @@ use Symfony\Component\EventDispatcher\Event;
* @property \Model\ProjectAnalytic $projectAnalytic * @property \Model\ProjectAnalytic $projectAnalytic
* @property \Model\ProjectActivity $projectActivity * @property \Model\ProjectActivity $projectActivity
* @property \Model\ProjectDailySummary $projectDailySummary * @property \Model\ProjectDailySummary $projectDailySummary
* @property \Model\SubTask $subTask * @property \Model\Subtask $subtask
* @property \Model\Swimlane $swimlane * @property \Model\Swimlane $swimlane
* @property \Model\Task $task * @property \Model\Task $task
* @property \Model\TaskCreation $taskCreation * @property \Model\TaskCreation $taskCreation
@@ -168,7 +168,7 @@ abstract class Base
$this->handleAuthentication(); $this->handleAuthentication();
$this->handleAuthorization($controller, $action); $this->handleAuthorization($controller, $action);
$this->session['has_subtask_inprogress'] = $this->subTask->hasSubtaskInProgress($this->userSession->getId()); $this->session['has_subtask_inprogress'] = $this->subtask->hasSubtaskInProgress($this->userSession->getId());
} }
} }

View File

@@ -410,7 +410,7 @@ class Board extends Base
{ {
$task = $this->getTask(); $task = $this->getTask();
$this->response->html($this->template->render('board/subtasks', array( $this->response->html($this->template->render('board/subtasks', array(
'subtasks' => $this->subTask->getAll($task['id']), 'subtasks' => $this->subtask->getAll($task['id']),
'task' => $task, 'task' => $task,
))); )));
} }

View File

@@ -2,10 +2,10 @@
namespace Controller; namespace Controller;
use Model\SubTask as SubtaskModel; use Model\Subtask as SubtaskModel;
/** /**
* SubTask controller * Subtask controller
* *
* @package controller * @package controller
* @author Frederic Guillot * @author Frederic Guillot
@@ -20,7 +20,7 @@ class Subtask extends Base
*/ */
private function getSubtask() private function getSubtask()
{ {
$subtask = $this->subTask->getById($this->request->getIntegerParam('subtask_id')); $subtask = $this->subtask->getById($this->request->getIntegerParam('subtask_id'));
if (! $subtask) { if (! $subtask) {
$this->notfound(); $this->notfound();
@@ -63,11 +63,11 @@ class Subtask extends Base
$task = $this->getTask(); $task = $this->getTask();
$values = $this->request->getValues(); $values = $this->request->getValues();
list($valid, $errors) = $this->subTask->validateCreation($values); list($valid, $errors) = $this->subtask->validateCreation($values);
if ($valid) { if ($valid) {
if ($this->subTask->create($values)) { if ($this->subtask->create($values)) {
$this->session->flash(t('Sub-task added successfully.')); $this->session->flash(t('Sub-task added successfully.'));
} }
else { else {
@@ -98,7 +98,7 @@ class Subtask extends Base
'values' => empty($values) ? $subtask : $values, 'values' => empty($values) ? $subtask : $values,
'errors' => $errors, 'errors' => $errors,
'users_list' => $this->projectPermission->getMemberList($task['project_id']), 'users_list' => $this->projectPermission->getMemberList($task['project_id']),
'status_list' => $this->subTask->getStatusList(), 'status_list' => $this->subtask->getStatusList(),
'subtask' => $subtask, 'subtask' => $subtask,
'task' => $task, 'task' => $task,
))); )));
@@ -115,11 +115,11 @@ class Subtask extends Base
$this->getSubtask(); $this->getSubtask();
$values = $this->request->getValues(); $values = $this->request->getValues();
list($valid, $errors) = $this->subTask->validateModification($values); list($valid, $errors) = $this->subtask->validateModification($values);
if ($valid) { if ($valid) {
if ($this->subTask->update($values)) { if ($this->subtask->update($values)) {
$this->session->flash(t('Sub-task updated successfully.')); $this->session->flash(t('Sub-task updated successfully.'));
} }
else { else {
@@ -159,7 +159,7 @@ class Subtask extends Base
$task = $this->getTask(); $task = $this->getTask();
$subtask = $this->getSubtask(); $subtask = $this->getSubtask();
if ($this->subTask->remove($subtask['id'])) { if ($this->subtask->remove($subtask['id'])) {
$this->session->flash(t('Sub-task removed successfully.')); $this->session->flash(t('Sub-task removed successfully.'));
} }
else { else {
@@ -180,14 +180,14 @@ class Subtask extends Base
$subtask = $this->getSubtask(); $subtask = $this->getSubtask();
$redirect = $this->request->getStringParam('redirect', 'task'); $redirect = $this->request->getStringParam('redirect', 'task');
$this->subTask->toggleStatus($subtask['id']); $this->subtask->toggleStatus($subtask['id']);
if ($redirect === 'board') { if ($redirect === 'board') {
$this->session['has_subtask_inprogress'] = $this->subTask->hasSubtaskInProgress($this->userSession->getId()); $this->session['has_subtask_inprogress'] = $this->subtask->hasSubtaskInProgress($this->userSession->getId());
$this->response->html($this->template->render('board/subtasks', array( $this->response->html($this->template->render('board/subtasks', array(
'subtasks' => $this->subTask->getAll($task['id']), 'subtasks' => $this->subtask->getAll($task['id']),
'task' => $task, 'task' => $task,
))); )));
} }
@@ -210,7 +210,7 @@ class Subtask extends Base
SubtaskModel::STATUS_TODO => t('Todo'), SubtaskModel::STATUS_TODO => t('Todo'),
SubtaskModel::STATUS_DONE => t('Done'), SubtaskModel::STATUS_DONE => t('Done'),
), ),
'subtask_inprogress' => $this->subTask->getSubtaskInProgress($this->userSession->getId()), 'subtask_inprogress' => $this->subtask->getSubtaskInProgress($this->userSession->getId()),
'subtask' => $subtask, 'subtask' => $subtask,
'task' => $task, 'task' => $task,
'redirect' => $this->request->getStringParam('redirect'), 'redirect' => $this->request->getStringParam('redirect'),
@@ -229,13 +229,13 @@ class Subtask extends Base
$values = $this->request->getValues(); $values = $this->request->getValues();
// Change status of the previous in progress subtask // Change status of the previous in progress subtask
$this->subTask->update(array( $this->subtask->update(array(
'id' => $values['id'], 'id' => $values['id'],
'status' => $values['status'], 'status' => $values['status'],
)); ));
// Set the current subtask to in pogress // Set the current subtask to in pogress
$this->subTask->update(array( $this->subtask->update(array(
'id' => $subtask['id'], 'id' => $subtask['id'],
'status' => SubtaskModel::STATUS_INPROGRESS, 'status' => SubtaskModel::STATUS_INPROGRESS,
)); ));

View File

@@ -35,7 +35,7 @@ class Task extends Base
$this->response->html($this->template->layout('task/public', array( $this->response->html($this->template->layout('task/public', array(
'project' => $project, 'project' => $project,
'comments' => $this->comment->getAll($task['id']), 'comments' => $this->comment->getAll($task['id']),
'subtasks' => $this->subTask->getAll($task['id']), 'subtasks' => $this->subtask->getAll($task['id']),
'task' => $task, 'task' => $task,
'columns_list' => $this->board->getColumnsList($task['project_id']), 'columns_list' => $this->board->getColumnsList($task['project_id']),
'colors_list' => $this->color->getList(), 'colors_list' => $this->color->getList(),
@@ -54,7 +54,7 @@ class Task extends Base
public function show() public function show()
{ {
$task = $this->getTask(); $task = $this->getTask();
$subtasks = $this->subTask->getAll($task['id']); $subtasks = $this->subtask->getAll($task['id']);
$values = array( $values = array(
'id' => $task['id'], 'id' => $task['id'],

View File

@@ -29,7 +29,7 @@ use Pimple\Container;
* @property \Model\Project $project * @property \Model\Project $project
* @property \Model\ProjectDuplication $projectDuplication * @property \Model\ProjectDuplication $projectDuplication
* @property \Model\ProjectPermission $projectPermission * @property \Model\ProjectPermission $projectPermission
* @property \Model\SubTask $subTask * @property \Model\Subtask $subtask
* @property \Model\SubtaskHistory $subtaskHistory * @property \Model\SubtaskHistory $subtaskHistory
* @property \Model\Swimlane $swimlane * @property \Model\Swimlane $swimlane
* @property \Model\Task $task * @property \Model\Task $task

View File

@@ -162,9 +162,9 @@ class ProjectActivity extends Base
return t('%s moved the task #%d to the column "%s"', $event['author'], $event['task']['id'], $event['task']['column_title']); return t('%s moved the task #%d to the column "%s"', $event['author'], $event['task']['id'], $event['task']['column_title']);
case Task::EVENT_MOVE_POSITION: case Task::EVENT_MOVE_POSITION:
return t('%s moved the task #%d to the position %d in the column "%s"', $event['author'], $event['task']['id'], $event['task']['position'], $event['task']['column_title']); return t('%s moved the task #%d to the position %d in the column "%s"', $event['author'], $event['task']['id'], $event['task']['position'], $event['task']['column_title']);
case SubTask::EVENT_UPDATE: case Subtask::EVENT_UPDATE:
return t('%s updated a subtask for the task #%d', $event['author'], $event['task']['id']); return t('%s updated a subtask for the task #%d', $event['author'], $event['task']['id']);
case SubTask::EVENT_CREATE: case Subtask::EVENT_CREATE:
return t('%s created a subtask for the task #%d', $event['author'], $event['task']['id']); return t('%s created a subtask for the task #%d', $event['author'], $event['task']['id']);
case Comment::EVENT_UPDATE: case Comment::EVENT_UPDATE:
return t('%s updated a comment on the task #%d', $event['author'], $event['task']['id']); return t('%s updated a comment on the task #%d', $event['author'], $event['task']['id']);

View File

@@ -12,7 +12,7 @@ use SimpleValidator\Validators;
* @package model * @package model
* @author Frederic Guillot * @author Frederic Guillot
*/ */
class SubTask extends Base class Subtask extends Base
{ {
/** /**
* SQL table name * SQL table name
@@ -93,16 +93,16 @@ class SubTask extends Base
*/ */
public function getUserQuery($user_id, array $status) public function getUserQuery($user_id, array $status)
{ {
return $this->db->table(SubTask::TABLE) return $this->db->table(Subtask::TABLE)
->columns( ->columns(
SubTask::TABLE.'.*', Subtask::TABLE.'.*',
Task::TABLE.'.project_id', Task::TABLE.'.project_id',
Task::TABLE.'.color_id', Task::TABLE.'.color_id',
Project::TABLE.'.name AS project_name' Project::TABLE.'.name AS project_name'
) )
->eq('user_id', $user_id) ->eq('user_id', $user_id)
->eq(Project::TABLE.'.is_active', Project::ACTIVE) ->eq(Project::TABLE.'.is_active', Project::ACTIVE)
->in(SubTask::TABLE.'.status', $status) ->in(Subtask::TABLE.'.status', $status)
->join(Task::TABLE, 'id', 'task_id') ->join(Task::TABLE, 'id', 'task_id')
->join(Project::TABLE, 'id', 'project_id', Task::TABLE) ->join(Project::TABLE, 'id', 'project_id', Task::TABLE)
->filter(array($this, 'addStatusName')); ->filter(array($this, 'addStatusName'));
@@ -283,7 +283,7 @@ class SubTask extends Base
{ {
return $this->db->transaction(function ($db) use ($src_task_id, $dst_task_id) { return $this->db->transaction(function ($db) use ($src_task_id, $dst_task_id) {
$subtasks = $db->table(SubTask::TABLE) $subtasks = $db->table(Subtask::TABLE)
->columns('title', 'time_estimated') ->columns('title', 'time_estimated')
->eq('task_id', $src_task_id) ->eq('task_id', $src_task_id)
->asc('id') // Explicit sorting for postgresql ->asc('id') // Explicit sorting for postgresql
@@ -293,7 +293,7 @@ class SubTask extends Base
$subtask['task_id'] = $dst_task_id; $subtask['task_id'] = $dst_task_id;
if (! $db->table(SubTask::TABLE)->save($subtask)) { if (! $db->table(Subtask::TABLE)->save($subtask)) {
return false; return false;
} }
} }

View File

@@ -29,7 +29,7 @@ class SubtaskExport extends Base
*/ */
public function export($project_id, $from, $to) public function export($project_id, $from, $to)
{ {
$this->subtask_status = $this->subTask->getStatusList(); $this->subtask_status = $this->subtask->getStatusList();
$subtasks = $this->getSubtasks($project_id, $from, $to); $subtasks = $this->getSubtasks($project_id, $from, $to);
$results = array($this->getColumns()); $results = array($this->getColumns());
@@ -101,10 +101,10 @@ class SubtaskExport extends Base
$to = $this->dateParser->removeTimeFromTimestamp(strtotime('+1 day', $this->dateParser->getTimestamp($to))); $to = $this->dateParser->removeTimeFromTimestamp(strtotime('+1 day', $this->dateParser->getTimestamp($to)));
} }
return $this->db->table(SubTask::TABLE) return $this->db->table(Subtask::TABLE)
->eq('project_id', $project_id) ->eq('project_id', $project_id)
->columns( ->columns(
SubTask::TABLE.'.*', Subtask::TABLE.'.*',
User::TABLE.'.username AS assignee_username', User::TABLE.'.username AS assignee_username',
User::TABLE.'.name AS assignee_name', User::TABLE.'.name AS assignee_name',
Task::TABLE.'.title AS task_title' Task::TABLE.'.title AS task_title'
@@ -113,7 +113,7 @@ class SubtaskExport extends Base
->lte('date_creation', $to) ->lte('date_creation', $to)
->join(Task::TABLE, 'id', 'task_id') ->join(Task::TABLE, 'id', 'task_id')
->join(User::TABLE, 'id', 'user_id') ->join(User::TABLE, 'id', 'user_id')
->asc(SubTask::TABLE.'.id') ->asc(Subtask::TABLE.'.id')
->findAll(); ->findAll();
} }
} }

View File

@@ -33,13 +33,13 @@ class SubtaskTimeTracking extends Base
self::TABLE.'.subtask_id', self::TABLE.'.subtask_id',
self::TABLE.'.end', self::TABLE.'.end',
self::TABLE.'.start', self::TABLE.'.start',
SubTask::TABLE.'.task_id', Subtask::TABLE.'.task_id',
SubTask::TABLE.'.title AS subtask_title', Subtask::TABLE.'.title AS subtask_title',
Task::TABLE.'.title AS task_title', Task::TABLE.'.title AS task_title',
Task::TABLE.'.project_id' Task::TABLE.'.project_id'
) )
->join(SubTask::TABLE, 'id', 'subtask_id') ->join(Subtask::TABLE, 'id', 'subtask_id')
->join(Task::TABLE, 'id', 'task_id', SubTask::TABLE) ->join(Task::TABLE, 'id', 'task_id', Subtask::TABLE)
->eq(self::TABLE.'.user_id', $user_id); ->eq(self::TABLE.'.user_id', $user_id);
} }

View File

@@ -158,7 +158,7 @@ class TaskDuplication extends Base
$new_task_id = $this->taskCreation->create($values); $new_task_id = $this->taskCreation->create($values);
if ($new_task_id) { if ($new_task_id) {
$this->subTask->duplicate($task_id, $new_task_id); $this->subtask->duplicate($task_id, $new_task_id);
} }
return $new_task_id; return $new_task_id;

View File

@@ -31,7 +31,7 @@ class ClassProvider implements ServiceProviderInterface
'ProjectDuplication', 'ProjectDuplication',
'ProjectDailySummary', 'ProjectDailySummary',
'ProjectPermission', 'ProjectPermission',
'SubTask', 'Subtask',
'SubtaskExport', 'SubtaskExport',
'SubtaskTimeTracking', 'SubtaskTimeTracking',
'Swimlane', 'Swimlane',

View File

@@ -18,7 +18,7 @@ use Pimple\Container;
* @property \Model\ProjectPermission $projectPermission * @property \Model\ProjectPermission $projectPermission
* @property \Model\ProjectAnalytic $projectAnalytic * @property \Model\ProjectAnalytic $projectAnalytic
* @property \Model\ProjectDailySummary $projectDailySummary * @property \Model\ProjectDailySummary $projectDailySummary
* @property \Model\SubTask $subTask * @property \Model\Subtask $subtask
* @property \Model\Task $task * @property \Model\Task $task
* @property \Model\TaskExport $taskExport * @property \Model\TaskExport $taskExport
* @property \Model\TaskFinder $taskFinder * @property \Model\TaskFinder $taskFinder

View File

@@ -5,7 +5,7 @@ namespace Subscriber;
use Event\GenericEvent; use Event\GenericEvent;
use Model\Task; use Model\Task;
use Model\Comment; use Model\Comment;
use Model\SubTask; use Model\Subtask;
use Model\File; use Model\File;
use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\EventDispatcher\EventSubscriberInterface;
@@ -19,8 +19,8 @@ class NotificationSubscriber extends Base implements EventSubscriberInterface
Task::EVENT_MOVE_COLUMN => 'task_move_column', Task::EVENT_MOVE_COLUMN => 'task_move_column',
Task::EVENT_MOVE_POSITION => 'task_move_position', Task::EVENT_MOVE_POSITION => 'task_move_position',
Task::EVENT_ASSIGNEE_CHANGE => 'task_assignee_change', Task::EVENT_ASSIGNEE_CHANGE => 'task_assignee_change',
SubTask::EVENT_CREATE => 'subtask_creation', Subtask::EVENT_CREATE => 'subtask_creation',
SubTask::EVENT_UPDATE => 'subtask_update', Subtask::EVENT_UPDATE => 'subtask_update',
Comment::EVENT_CREATE => 'comment_creation', Comment::EVENT_CREATE => 'comment_creation',
Comment::EVENT_UPDATE => 'comment_update', Comment::EVENT_UPDATE => 'comment_update',
File::EVENT_CREATE => 'file_creation', File::EVENT_CREATE => 'file_creation',
@@ -36,8 +36,8 @@ class NotificationSubscriber extends Base implements EventSubscriberInterface
Task::EVENT_MOVE_COLUMN => array('execute', 0), Task::EVENT_MOVE_COLUMN => array('execute', 0),
Task::EVENT_MOVE_POSITION => array('execute', 0), Task::EVENT_MOVE_POSITION => array('execute', 0),
Task::EVENT_ASSIGNEE_CHANGE => array('execute', 0), Task::EVENT_ASSIGNEE_CHANGE => array('execute', 0),
SubTask::EVENT_CREATE => array('execute', 0), Subtask::EVENT_CREATE => array('execute', 0),
SubTask::EVENT_UPDATE => array('execute', 0), Subtask::EVENT_UPDATE => array('execute', 0),
Comment::EVENT_CREATE => array('execute', 0), Comment::EVENT_CREATE => array('execute', 0),
Comment::EVENT_UPDATE => array('execute', 0), Comment::EVENT_UPDATE => array('execute', 0),
File::EVENT_CREATE => array('execute', 0), File::EVENT_CREATE => array('execute', 0),
@@ -63,7 +63,7 @@ class NotificationSubscriber extends Base implements EventSubscriberInterface
$values['task'] = $this->taskFinder->getDetails($event['task_id']); $values['task'] = $this->taskFinder->getDetails($event['task_id']);
break; break;
case 'Event\SubtaskEvent': case 'Event\SubtaskEvent':
$values['subtask'] = $this->subTask->getById($event['id'], true); $values['subtask'] = $this->subtask->getById($event['id'], true);
$values['task'] = $this->taskFinder->getDetails($event['task_id']); $values['task'] = $this->taskFinder->getDetails($event['task_id']);
break; break;
case 'Event\FileEvent': case 'Event\FileEvent':

View File

@@ -5,7 +5,7 @@ namespace Subscriber;
use Event\GenericEvent; use Event\GenericEvent;
use Model\Task; use Model\Task;
use Model\Comment; use Model\Comment;
use Model\SubTask; use Model\Subtask;
use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\EventDispatcher\EventSubscriberInterface;
class ProjectActivitySubscriber extends Base implements EventSubscriberInterface class ProjectActivitySubscriber extends Base implements EventSubscriberInterface
@@ -22,8 +22,8 @@ class ProjectActivitySubscriber extends Base implements EventSubscriberInterface
Task::EVENT_MOVE_POSITION => array('execute', 0), Task::EVENT_MOVE_POSITION => array('execute', 0),
Comment::EVENT_UPDATE => array('execute', 0), Comment::EVENT_UPDATE => array('execute', 0),
Comment::EVENT_CREATE => array('execute', 0), Comment::EVENT_CREATE => array('execute', 0),
SubTask::EVENT_UPDATE => array('execute', 0), Subtask::EVENT_UPDATE => array('execute', 0),
SubTask::EVENT_CREATE => array('execute', 0), Subtask::EVENT_CREATE => array('execute', 0),
); );
} }
@@ -51,7 +51,7 @@ class ProjectActivitySubscriber extends Base implements EventSubscriberInterface
switch (get_class($event)) { switch (get_class($event)) {
case 'Event\SubtaskEvent': case 'Event\SubtaskEvent':
$values['subtask'] = $this->subTask->getById($event['id'], true); $values['subtask'] = $this->subtask->getById($event['id'], true);
break; break;
case 'Event\CommentEvent': case 'Event\CommentEvent':
$values['comment'] = $this->comment->getById($event['id']); $values['comment'] = $this->comment->getById($event['id']);

View File

@@ -3,7 +3,7 @@
namespace Subscriber; namespace Subscriber;
use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Model\SubTask; use Model\Subtask;
use Event\SubtaskEvent; use Event\SubtaskEvent;
class SubtaskTimesheetSubscriber extends Base implements EventSubscriberInterface class SubtaskTimesheetSubscriber extends Base implements EventSubscriberInterface
@@ -11,7 +11,7 @@ class SubtaskTimesheetSubscriber extends Base implements EventSubscriberInterfac
public static function getSubscribedEvents() public static function getSubscribedEvents()
{ {
return array( return array(
SubTask::EVENT_UPDATE => array('log', 0), Subtask::EVENT_UPDATE => array('log', 0),
); );
} }
@@ -19,9 +19,9 @@ class SubtaskTimesheetSubscriber extends Base implements EventSubscriberInterfac
{ {
if (isset($event['status'])) { if (isset($event['status'])) {
$subtask = $this->subTask->getById($event['id']); $subtask = $this->subtask->getById($event['id']);
if ($subtask['status'] == SubTask::STATUS_INPROGRESS) { if ($subtask['status'] == Subtask::STATUS_INPROGRESS) {
$this->subtaskTimeTracking->logStartTime($subtask['id'], $subtask['user_id']); $this->subtaskTimeTracking->logStartTime($subtask['id'], $subtask['user_id']);
} }
else { else {

View File

@@ -271,9 +271,9 @@ $server->register('updateComment', function($id, $content) use ($container) {
/** /**
* Subtask procedures * Subtask procedures
*/ */
$server->bind('getSubtask', $container['subTask'], 'getById'); $server->bind('getSubtask', $container['subtask'], 'getById');
$server->bind('getAllSubtasks', $container['subTask'], 'getAll'); $server->bind('getAllSubtasks', $container['subtask'], 'getAll');
$server->bind('removeSubtask', $container['subTask'], 'remove'); $server->bind('removeSubtask', $container['subtask'], 'remove');
$server->register('createSubtask', function($task_id, $title, $user_id = 0, $time_estimated = 0, $time_spent = 0, $status = 0) use ($container) { $server->register('createSubtask', function($task_id, $title, $user_id = 0, $time_estimated = 0, $time_spent = 0, $status = 0) use ($container) {
@@ -291,13 +291,13 @@ $server->register('createSubtask', function($task_id, $title, $user_id = 0, $tim
unset($values[$key]); unset($values[$key]);
} }
} }
list($valid,) = $container['subTask']->validateCreation($values); list($valid,) = $container['subtask']->validateCreation($values);
if (! $valid) { if (! $valid) {
return false; return false;
} }
return $container['subTask']->create($values); return $container['subtask']->create($values);
}); });
$server->register('updateSubtask', function($id, $task_id, $title = null, $user_id = null, $time_estimated = null, $time_spent = null, $status = null) use ($container) { $server->register('updateSubtask', function($id, $task_id, $title = null, $user_id = null, $time_estimated = null, $time_spent = null, $status = null) use ($container) {
@@ -318,8 +318,8 @@ $server->register('updateSubtask', function($id, $task_id, $title = null, $user_
} }
} }
list($valid,) = $container['subTask']->validateApiModification($values); list($valid,) = $container['subtask']->validateApiModification($values);
return $valid && $container['subTask']->update($values); return $valid && $container['subtask']->update($values);
}); });
/** /**

View File

@@ -4,7 +4,7 @@
require __DIR__.'/../app/common.php'; require __DIR__.'/../app/common.php';
use Model\TaskCreation; use Model\TaskCreation;
use Model\SubTask; use Model\Subtask;
use Model\Project; use Model\Project;
use Model\ProjectPermission; use Model\ProjectPermission;
use Model\User; use Model\User;
@@ -15,7 +15,7 @@ $userModel = new User($container);
$projectModel = new Project($container); $projectModel = new Project($container);
$permissionModel = new ProjectPermission($container); $permissionModel = new ProjectPermission($container);
$taskModel = new TaskCreation($container); $taskModel = new TaskCreation($container);
$subtaskModel = new SubTask($container); $subtaskModel = new Subtask($container);
$project_id = $projectModel->create(array( $project_id = $projectModel->create(array(
'name' => 'Project #1' 'name' => 'Project #1'

View File

@@ -4,7 +4,7 @@ require_once __DIR__.'/Base.php';
use Model\Task; use Model\Task;
use Model\TaskCreation; use Model\TaskCreation;
use Model\SubTask; use Model\Subtask;
use Model\Project; use Model\Project;
use Model\Category; use Model\Category;
use Model\User; use Model\User;
@@ -14,7 +14,7 @@ class SubTaskTest extends Base
public function testDuplicate() public function testDuplicate()
{ {
$tc = new TaskCreation($this->container); $tc = new TaskCreation($this->container);
$s = new SubTask($this->container); $s = new Subtask($this->container);
$p = new Project($this->container); $p = new Project($this->container);
// We create a project // We create a project

View File

@@ -2,7 +2,7 @@
require_once __DIR__.'/Base.php'; require_once __DIR__.'/Base.php';
use Model\SubTask; use Model\Subtask;
use Model\TaskModification; use Model\TaskModification;
use Model\TaskCreation; use Model\TaskCreation;
use Model\TaskFinder; use Model\TaskFinder;
@@ -17,7 +17,7 @@ class TimeTrackingTest extends Base
$tc = new TaskCreation($this->container); $tc = new TaskCreation($this->container);
$tf = new TaskFinder($this->container); $tf = new TaskFinder($this->container);
$p = new Project($this->container); $p = new Project($this->container);
$s = new SubTask($this->container); $s = new Subtask($this->container);
$ts = new TimeTracking($this->container); $ts = new TimeTracking($this->container);
$this->assertEquals(1, $p->create(array('name' => 'Project #1'))); $this->assertEquals(1, $p->create(array('name' => 'Project #1')));