/** * Find model by ID. * * @param integer|array $id Model ID * * @return PageModel * * @throws HttpException 404 error if model not found */ protected function findModel($id) { if (is_array($id)) { $model = PageModel::findAll($id); } else { $model = PageModel::findOne($id); } if ($model !== null) { return $model; } else { throw new HttpException(404); } }