Example #1
0
 public function updateTask(ActPacket $actPacket)
 {
     // If it's a recurring type task, and the old value of starting date time is not change, then updated it
     if ($actPacket->getTypeId() == Task::TYPE_ID_RECURRENT && $actPacket->getStartingDateTime() == $this->actPacket->getStartingDateTime()) {
         $actPacket->setStartingDateTime(date('Y-m-d H:i:s'));
     }
     $id = $this->currentTask->getId();
     $request = new Request([['id' => $id], ['typeId' => $actPacket->getTypeId(), 'repeatingInterval' => $actPacket->getRepeatingInterval(), 'startingDateTime' => $actPacket->getStartingDateTime(), 'priority' => $actPacket->getPriority(), 'externalTypeId' => $actPacket->getExternalTypeId(), 'externalId' => $actPacket->getExternalId(), 'externalData' => $actPacket->getExternalData()]]);
     $this->runUseCaseWithNoOfRetriesOnFail('task|update', $request, $this->getMaxRetries());
     if ($this->getUseCaseResponseStatus() == Response::STATUS_FAIL) {
         $this->lastOperationSuccess = false;
     }
     // Update the current task
     $this->currentTask->setTypeId($actPacket->getTypeId());
     $this->lastOperationSuccess = true;
 }