Ejemplo n.º 1
0
 /**
  * Sets the task status to "stopped".
  *
  * @param Task $task
  *
  * @return Task
  */
 public function stop(Task $task)
 {
     $task->setStatus(Task::STATUS_STOPPED);
     $this->om->persist($task);
     $this->om->flush();
     $this->notify(NotifierInterface::MESSAGE_UPDATE);
     return $task;
 }
 /**
  * {@inheritDoc}
  */
 public function setStatus($status)
 {
     $this->__initializer__ && $this->__initializer__->__invoke($this, 'setStatus', array($status));
     return parent::setStatus($status);
 }
Ejemplo n.º 3
0
 public function setTaskPropertyAction(Request $request, Task $task)
 {
     $title = $request->get('title');
     $autostart = $request->get('autostart');
     if (null === $title && null === $autostart) {
         return $this->getBadRequestAction($request);
     }
     if ($title) {
         $task->setName($title);
     }
     if ($autostart) {
         $task->setStatus(Task::STATUS_STARTED);
     }
     return $this->showTaskAction($request, $task);
 }
Ejemplo n.º 4
0
 /**
  * Update a task property
  *  - name
  *  - autostart
  *
  * @param  \Silex\Application $app  Silex application
  * @param  Task               $task The task
  *
  * @return Response
  */
 public function set_task_property(Application $app, Request $request, $task)
 {
     $title = $app['request']->get('title');
     $autostart = $app['request']->get('autostart');
     if (null === $title && null === $autostart) {
         return $this->getBadRequest($app, $request);
     }
     if ($title) {
         $task->setName($title);
     }
     if ($autostart) {
         $task->setStatus(Task::STATUS_STARTED);
     }
     return Result::create($request, ['task' => $this->list_task($app, $task)])->createResponse();
 }
Ejemplo n.º 5
0
 /**
  * Update a task property
  *  - name
  *  - autostart
  *
  * @param  \Silex\Application           $app  Silex application
  * @param  Task                         $task The task
  * @return \API_V1_result
  * @throws \API_V1_exception_badrequest
  */
 public function set_task_property(Application $app, $task)
 {
     $result = new API_V1_result($app, $app['request'], $this);
     $title = $app['request']->get('title');
     $autostart = $app['request']->get('autostart');
     if (null === $title && null === $autostart) {
         throw new \API_V1_exception_badrequest();
     }
     if ($title) {
         $task->setName($title);
     }
     if ($autostart) {
         $task->setStatus(Task::STATUS_STARTED);
     }
     $result->set_datas(['task' => $this->list_task($app, $task)]);
     return $result;
 }