protected function getPost($key) { $item = $this->finder->findPost(['key' => $key])->one(); if ($item) { return $item; } else { throw new \yii\web\NotFoundHttpException(Yii::t('blog', 'The requested post does not exist')); } }
/** * * insertMenueCommand * * @param String $ErrorString * @param String $StatusString */ public function insertMenueCommand($ErrorString = "", $StatusString = "") { if (Controler_Main::getInstance()->getUserLevel() < BACKEND_USERLEVEL) { $ControlerStart = new Controler_Start(); $ControlerStart->start(); return false; } $Request = new Request(); $ErrorString = ""; $StatusString = ""; $MenueFinder = new MenueFinder(); $ContentFinder = new ContentFinder(); $ContentManager = new ContentManager(); $CommandFinder = new CommandFinder(); $LinkName = $Request->getAsString("tb_LinkName"); $MenueID = $Request->getAsString("MenueID"); $InsertCommandID = $Request->getAsString("InsertCommandID"); $InsertViewID = $Request->getAsString("InsertDisplayID"); $InsertCommandGroupID = $Request->getAsString("InsertContentGroupID"); $ContentCollection = $ContentFinder->findByMenueIdAndCommandId($MenueID, $InsertCommandID, $InsertViewID); $Content = $ContentCollection->getByIndex(0); $ID = $Content->getId(); if ($ID != 0) { $ErrorString .= ":T_MENUE_ERROR2:"; } if (strlen($ErrorString) != 0) { $this->showEditMenue($ErrorString, $StatusString); return false; } $Command = $CommandFinder->findById($InsertCommandID); $Position = 1; $Checker = $ContentManager->insertMenueCommandByMenueIdAndCommandId($MenueID, $InsertCommandID, $Command->getName(), $InsertViewID, $InsertCommandGroupID, $Position); if (false == $Checker) { $ErrorString .= ":T_MENUE_ERROR3:"; $this->showEditMenue($ErrorString, $StatusString); return false; } $this->showEditMenue("", ":T_MENUE_INSERT_COMMAND_STATUS:"); }