Exemplo n.º 1
0
 /**
  * Displays a single Picture model.
  * @param integer $id
  * @return mixed
  */
 public function actionPicture($id, $size = 'full')
 {
     if (($model = Picture::findOne($id)) === null) {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
     if (!$model) {
         $model = new Picture();
     }
     $this->redirect($model->directlink($size), 301);
 }
Exemplo n.º 2
0
 /**
  * Finds the Picture model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Picture the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Picture::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }