public function diagnosticAction() { if (!$this->getRequest()->isGet()) { throw new UnexpectedException("Resquest must be GET"); } $transactionId = $this->_getTransactionId(); try { $result = $this->_service->load($transactionId); if ($result->status == WatcherModel::STATUS_FINISHED) { // Check permissions $this->_helper->allowed('read', $result); $events = $result->getEventList(); $event = array_pop($events); // Return async response $data = $event->eventData; $code = $data['message']['execResult']['code']; $reason = $data['message']['execResult']['reason']; if ($code == "0") { $this->view->result = $reason; } else { $this->view->AsyncException = new External\Model\AsyncErrorModel(array('exceptionId' => $code, 'text' => $reason)); } } } catch (Exception $e) { \App::log()->warn($e); } }
public function diagnosticAction() { if (!$this->getRequest()->isGet()) { throw new UnexpectedException("Resquest must be GET"); } $transactionId = $this->_getTransactionId(); $result = $this->_service->load($transactionId); if (!$result) { throw new NotFoundException("Resource {$transactionId} not found"); } try { if ($result->status == WatcherModel::STATUS_FINISHED) { // Check permissions $this->_helper->allowed('read', $result); $events = $result->getEventList(); $event = array_pop($events); // Return async response $data = $event->eventData; $code = $data['message']['execResult']['code']; $reason = $data['message']['execResult']['reason']; if ($code == "0") { $this->view->result = $reason; } else { $this->view->result = "ERROR"; $this->view->reason = "[{$code}] " . $reason; } } } catch (Exception $e) { \App::log()->warn($e); } }
public function testCreateAndLoad() { $transactionId = $this->_transactionIds[0]; // Create $model = new Async\Model\AsyncTransaction(); $model->setId($transactionId); $model->tags = array('ewewe', '2222ee'); $model->ids = array('ewwwwewe', '2ww222ee'); $this->_asyncService->create($model); // Load $result = $this->_asyncService->load($transactionId); $this->assertNotNull($result->tags); $this->assertEquals($model->tags, $result->tags); $this->assertNotNull($result->ids); $this->assertEquals($model->ids, $result->ids); }