public function actionGetOptimalPrice($from, $to, $dateStart, $dateEnd, $forceUpdate) { try { $price = MFlightSearch::getOptimalPrice($from, $to, $dateStart, $dateEnd, $forceUpdate); $this->send($price); die; } catch (Exception $e) { $this->sendError(500, $e->getMessage()); } }