private function get_news() { if ($this->news === null) { $this->news = NewsService::get_news('WHERE id=:id', array('id' => $this->get_id_in_module())); } return $this->news; }
private function get_news(HTTPRequestCustom $request) { $id = $request->get_getint('id', 0); if (!empty($id)) { try { return NewsService::get_news('WHERE id=:id', array('id' => $id)); } catch (RowNotFoundException $e) { $error_controller = PHPBoostErrors::unexisting_page(); DispatchManager::redirect($error_controller); } } }
private function get_news() { if ($this->news === null) { $id = AppContext::get_request()->get_getint('id', 0); if (!empty($id)) { try { $this->news = NewsService::get_news('WHERE id=:id', array('id' => $id)); } catch (RowNotFoundException $e) { $error_controller = PHPBoostErrors::unexisting_page(); DispatchManager::redirect($error_controller); } } else { $this->news = new News(); } } return $this->news; }
private function get_news() { if ($this->news === null) { $id = AppContext::get_request()->get_getint('id', 0); if (!empty($id)) { try { $this->news = NewsService::get_news('WHERE id=:id', array('id' => $id)); } catch (RowNotFoundException $e) { $error_controller = PHPBoostErrors::unexisting_page(); DispatchManager::redirect($error_controller); } } else { $this->is_new_news = true; $this->news = new News(); $this->news->init_default_properties(AppContext::get_request()->get_getint('id_category', Category::ROOT_CATEGORY)); } } return $this->news; }