本文整理汇总了PHP中Task::setStatus方法的典型用法代码示例。如果您正苦于以下问题:PHP Task::setStatus方法的具体用法?PHP Task::setStatus怎么用?PHP Task::setStatus使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Task
的用法示例。
在下文中一共展示了Task::setStatus方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createTask
/**
* @param $taskName
* @param $taskDesc
* @param $taskDueDate
* @param $taskStatus
* @param null $userId
* @param null $projectId
* @return bool
* @throws \Exception
*/
public function createTask($taskName, $taskDesc, $taskDueDate, $taskStatus, $userId = null, $projectId = null)
{
$task = new Task();
$task->setTitle($taskName);
$task->setDescription($taskDesc);
$task->setDueDate(new \DateTime($taskDueDate));
$task->setStatus($taskStatus);
if ($projectId) {
$project = $this->em->getRepository('AppBundle:Project');
$task->setProject($project->find($project_id));
}
if ($userId) {
$user = $this->em->getRepository('AppBundle:User');
$task->setUser($user->find($useId));
}
try {
$this->em->persist($task);
$this->em->flush();
return true;
} catch (\Exception $e) {
throw $e;
}
}
示例2: sendTaskToWorker
/**
* Send task over RPC to worker
* Mark task as in progress nad worker as busy
* @param Task $task
* @param Worker $worker
* @return void
* @author Andraz <andraz.krascek@gmail.com>
*/
public function sendTaskToWorker(Task $task, Worker $worker)
{
$client = $this->newRpcClient($worker->getHost(), $worker->getport());
$parameters = [$worker->getId(), $task->getId(), $task->getParameters()];
$task->setStatus('in_progress');
$this->storage->saveTask($task);
$worker->setStatus('busy');
$this->storage->saveWorker($worker);
$success = $client->notify('run', $parameters);
if ($success) {
}
return $success;
}
示例3: executeAddTask
public function executeAddTask()
{
$project = ProjectPeer::retrieveByUuid($this->getRequestParameter('slug'));
// TODO: make sure user is a member of project
$this->forward404Unless($project, 'Project not found, or user is not member, unable to add task');
$this->forward404Unless($user = sfGuardUserProfilePeer::retrieveByUuid($this->getRequestParameter('task_user'), 'Unable to retrieve user'));
// TODO: add validation for task input
$task = new Task();
$task->setProjectId($project->getId());
$task->setOwnerId($this->getUser()->getProfile()->getUserID());
$task->setName($this->getRequestParameter('name', 'Task Name'));
$task->setDescription($this->getRequestParameter('description', 'Task Description'));
if ($this->getRequestParameter('begin')) {
list($d, $m, $y) = sfI18N::getDateForCulture($this->getRequestParameter('begin'), $this->getUser()->getCulture());
$task->setBegin("{$y}-{$m}-{$d}");
}
if ($this->getRequestParameter('finish')) {
list($d, $m, $y) = sfI18N::getDateForCulture($this->getRequestParameter('finish'), $this->getUser()->getCulture());
$task->setFinish("{$y}-{$m}-{$d}");
}
$task->setStatus(sfConfig::get('app_task_status_open'));
$task->setPriority($this->getRequestParameter('priority'));
$task->save();
//if ($user != null) $task->addUser($user->getUserId());
$task->addUser($user->getUserId());
$this->redirect('@show_project_tasks?tab=tasks&project=' . $project->getSlug());
}
示例4: Event
if ($description != $task->getDescription()) {
// save changes
$oldDescription = $task->getDescription();
$task->setDescription($description);
$task->save();
// log it
$logEvent = new Event(array('event_type_id' => 'edit_task_description', 'project_id' => $project->getID(), 'user_1_id' => Session::getUserID(), 'item_1_id' => $task->getID(), 'data_1' => $oldDescription, 'data_2' => $description));
$logEvent->save();
// set flag
$modified = true;
}
// is status modified?
if ($status != $task->getStatus()) {
// save changes
$oldStatus = $task->getStatus();
$task->setStatus($status);
$task->save();
// log it
$logEvent = new Event(array('event_type_id' => 'edit_task_status', 'project_id' => $project->getID(), 'user_1_id' => Session::getUserID(), 'item_1_id' => $task->getID(), 'data_1' => $oldStatus, 'data_2' => $status));
$logEvent->save();
// set flag
$modified = true;
}
// is num needed modified?
if ($numNeeded != $task->getNumNeeded()) {
// save changes
$oldNumNeeded = $task->getNumNeeded();
$task->setNumNeeded($numNeeded);
$task->save();
// log it
$logEvent = new Event(array('event_type_id' => 'edit_task_num_needed', 'project_id' => $project->getID(), 'user_1_id' => Session::getUserID(), 'item_1_id' => $task->getID(), 'data_1' => $oldNumNeeded, 'data_2' => $numNeeded));
示例5: getTask
/**
* Get task by id
* @param int $id
* @return Task null
*/
public function getTask($id)
{
$result = $this->db->query("SELECT * FROM tasks WHERE id = {$id} LIMIT 1");
foreach ($result as $key => $row) {
$task = new Task();
$task->setId($row['id']);
$task->setName($row['name']);
$task->setParameters($row['parameters']);
$task->setStatus($row['status']);
return $task;
}
return null;
}