public function callback(Information $info, ArrangeInterface $caller) { $packet = new ArrangePacket(); $packet->setExternalId(10); $packet->setExternalTypeId(2); $packet->setPriority(1); $packet->setTypeId(Task::TYPE_ID_RECURRENT); $packet->setRepeatingInterval(900); // Every 15 minutes $packet->setStartingDateTime(date('Y-m-d H:i:s')); $packet->setExternalData('test-' . mt_rand(0, 999999)); $caller->setPacket($packet, true); if ($caller->isLastOperationSucceeded()) { // Ok } }
public function callback(Information $info, ArrangeInterface $caller) { $packet = new ArrangePacket(); $packet->setExternalId(mt_rand(0, 9)); $packet->setExternalTypeId(2); $packet->setPriority(1); $packet->setStartingDateTime(date('Y-m-d H:i:s')); $packet->setExternalData('test'); $caller->setPacket($packet); if ($caller->isLastOperationSucceeded()) { // Ok } }
private function updateTask($id, ArrangePacket $arrangePacket) { $data = []; foreach ($arrangePacket->getAttributes() as $key => $value) { if ($value != null) { $data[$key] = $value; } } unset($data['creatingDateTime']); $request = new Request([['id' => $id], $data]); $this->runUseCaseWithNoOfRetriesOnFail('task|update', $request, $this->getMaxRetries()); if ($this->getUseCaseResponseStatus() == Response::STATUS_FAIL) { $this->lastOperationSuccess = false; } $this->lastOperationSuccess = true; }