public function ajaxPingReload($args) { $id = $args->id; $ping = PingHelper::reload($id); if ($ping) { $payload['success'] = true; $payload['message'] = 'Batch reloaded succesfully.'; $payload['payload'] = array('id' => $id); } else { $payload['success'] = false; $payload['message'] = 'Batch failed to be reloaded.'; $payload['payload'] = array('id' => -1); } $this->view->disable(); }
public function ajaxReload($args) { $manager = new TransactionManager(); $transaction = $manager->get(); $id = $args->id; try { $result = PingHelper::reload($id); if ($result) { $payload['success'] = true; $payload['message'] = 'Ping reloaded succesfully.'; $payload['payload'] = array('httpCode' => $result['httpCode'], 'duration' => $result['duration'], 'error' => $result['error']); } else { $payload['success'] = false; $payload['message'] = 'Ping not found.'; } $payload['payload'] += array('id' => $id); } catch (\Exception $ex) { $transaction->rollback(); $payload['success'] = false; $payload['message'] = 'Error reloading ping.'; $payload['payload'] = array('id' => $id); } return $payload; }