/** * @param dmWebRequest $request */ protected function getObjectOrForward404(dmWebRequest $request, $relations = array()) { if (!($this->object = $this->getObject($relations))) { $this->forward404(sprintf('Unable to find the %s object with the following parameters "%s").', $this->getDmModule()->getModel(), str_replace("\n", '', var_export($request->getParameterHolder()->getAll(), true)))); } return $this->object; }
/** * Renders a page based on DmPage ID * @param dmWebRequest $request */ public function executeOpenPageById(dmWebRequest $request) { $this->forward404Unless($page = dmDb::table('DmPage')->findOneById($request->getParameter('id'))); $this->redirect('/' . $page->getSlug()); $request->getParameterHolder()->set('slug', $page->getSlug()); }
protected function getObjectOrForward404(dmWebRequest $request) { $this->forward404Unless($record = $this->getDmModule()->getTable()->find($request->getParameter('pk')), sprintf('Unable to find the %s object with the following parameters "%s").', $this->getDmModule()->getModel(), str_replace("\n", '', var_export($request->getParameterHolder()->getAll(), true)))); return $record; }