From 15038cdb10f8c691edc7980fd1aed32dcbed3f9f Mon Sep 17 00:00:00 2001 From: Frédéric Guillot Date: Sat, 22 Nov 2014 10:05:44 -0500 Subject: Move task creation to a seperate class --- jsonrpc.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'jsonrpc.php') diff --git a/jsonrpc.php b/jsonrpc.php index 62537ff6..39c2f474 100644 --- a/jsonrpc.php +++ b/jsonrpc.php @@ -6,6 +6,7 @@ use JsonRPC\Server; use Model\Project; use Model\ProjectPermission; use Model\Task; +use Model\TaskCreation; use Model\TaskFinder; use Model\TaskStatus; use Model\TaskValidator; @@ -26,6 +27,7 @@ $config->setupTimezone(); $project = new Project($container); $projectPermission = new ProjectPermission($container); $task = new Task($container); +$taskCreation = new TaskCreation($container); $taskFinder = new TaskFinder($container); $taskStatus = new TaskStatus($container); $taskValidator = new TaskValidator($container); @@ -163,7 +165,7 @@ $server->register('allowUser', function($project_id, $user_id) use ($project, $p /** * Task procedures */ -$server->register('createTask', function($title, $project_id, $color_id = '', $column_id = 0, $owner_id = 0, $creator_id = 0, $date_due = '', $description = '', $category_id = 0, $score = 0) use ($task, $taskValidator) { +$server->register('createTask', function($title, $project_id, $color_id = '', $column_id = 0, $owner_id = 0, $creator_id = 0, $date_due = '', $description = '', $category_id = 0, $score = 0) use ($taskCreation, $taskValidator) { $values = array( 'title' => $title, @@ -179,7 +181,7 @@ $server->register('createTask', function($title, $project_id, $color_id = '', $c ); list($valid,) = $taskValidator->validateCreation($values); - return $valid && $task->create($values) !== false; + return $valid && $taskCreation->create($values) !== false; }); $server->register('getTask', function($task_id) use ($taskFinder) { -- cgit v1.2.3