private function get_message(HTTPRequestCustom $request) { $id = $request->get_getint('id', 0); if (!empty($id)) { try { return GuestbookService::get_message('WHERE id=:id', array('id' => $id)); } catch (RowNotFoundException $e) { $error_controller = PHPBoostErrors::unexisting_page(); DispatchManager::redirect($error_controller); } } }
private function get_message() { if ($this->message === null) { $id = AppContext::get_request()->get_getint('id', 0); if (!empty($id)) { try { $this->message = GuestbookService::get_message('WHERE id=:id', array('id' => $id)); } catch (RowNotFoundException $e) { $error_controller = PHPBoostErrors::unexisting_page(); DispatchManager::redirect($error_controller); } } else { $this->is_new_message = true; $this->message = new GuestbookMessage(); $this->message->init_default_properties(); } } return $this->message; }