@param $id

@return mixed
@throws NotFoundHttpException
176624
public function actionPdf($id) {
        $model = $this->findModel($id);
        $providerProductUnitEquivalent = new \yii\data\ArrayDataProvider([
            'allModels' => $model->productUnitEquivalents,
        ]);

        $content = $this->renderAjax('_pdf', [
            'model' => $model,
            'providerProductUnitEquivalent' => $providerProductUnitEquivalent,
        ]);

        $pdf = new \kartik\mpdf\Pdf([
            'mode' => \kartik\mpdf\Pdf::MODE_CORE,
            'format' => \kartik\mpdf\Pdf::FORMAT_A4,
            'orientation' => \kartik\mpdf\Pdf::ORIENT_PORTRAIT,
            'destination' => \kartik\mpdf\Pdf::DEST_BROWSER,
            'content' => $content,
            'cssFile' => '@vendor/kartik-v/yii2-mpdf/assets/kv-mpdf-bootstrap.min.css',
            'cssInline' => '.kv-heading-1{font-size:18px}',
            'options' => ['title' => \Yii::$app->name],
            'methods' => [
                'SetHeader' => [\Yii::$app->name],
                'SetFooter' => ['{PAGENO}'],
            ]
        ]);

        return $pdf->render();
    }
1003972
public function findModel($id)
    {
        if($this->_model === null) 
        {
            if($this->_model = $id ? Author::findOne($id) : null) 
            {
                return $this->_model;
            } else {
                throw new NotFoundHttpException(Module::t('core', 'The requested model does not exist.'));
            }
        }
    }
680579
protected function getTag($id)
    {
        $tag = $this->tagManager->find($id);

        if (null === $tag) {
            throw new NotFoundHttpException(sprintf('Tag (%d) not found', $id));
        }

        return $tag;
    }
577087
protected function findModel($id)
    {
        if (($model = Message::find()
                ->where(['id' => $id, 'parent' => null])->andWhere(['or', ['from_id' => Yii::$app->user->id], ['user_id' => Yii::$app->user->id]])->limit(1)->one()) !== null
        ) {
            return $model;
        } else {
            throw new NotFoundHttpException (Yii::t('message', 'The requested page does not exist.'));
        }
    }
743455
protected function findModel($id)
    {
        $auth = Configs::authManager();
        $item = $this->type === Item::TYPE_ROLE ? $auth->getRole($id) : $auth->getPermission($id);
        if ($item) {
            return new AuthItem($item);
        } else {
            throw new NotFoundHttpException('The requested page does not exist.');
        }
    }
941854
public function get($id)
    {
        if (isset($this->cache[$id])) {
            return $this->cache[$id];
        }

        throw new NotFoundException('No entry was found for this identifier.');
    }
331665
protected function findModel($id)
    {
        if (($model = Term::findOne($id)) !== null) {
            return $model;
        } else {
            throw new NotFoundHttpException(t('app', 'The requested page does not exist.'));
        }
    }
1143200
protected function findModel($id) {
    $user = User::findIdentity($id);
    if ($user === null) {
      throw new NotFoundHttpException('The requested page does not exist');
    }

    return $user;
  }
1189119
protected function getProduct($id)
    {
        $product = $this->productManager->findOneBy(['id' => $id]);

        if (null === $product) {
            throw new NotFoundHttpException(sprintf('Product (%d) not found', $id));
        }

        return $product;
    }
784994
protected function findModel($id)
    {
        $user = Page::findOne($id);
        if ($user === null) {
            throw new NotFoundHttpException(Yii::t('app', 'The requested page does not exist'));
        }
        return $user;
    }
286764
private function getBundleById($id)
    {
        if (null === $bundle = $this->getApplication()->getBundle($id)) {
            throw new NotFoundHttpException("No bundle exists with id `$id`");
        }

        return $bundle;
    }
183874
public function findModel($id)
    {
        $model = call_user_func_array([$this->MainModel, 'findOne'], [$id]);
        if ($model !== null) {
            return $model;
        } else {
            throw new NotFoundHttpException('The requested page does not exist.');
        }
    }
137962
public function getOrFail($id)
    {

        if ($model = $this->get($id)) {
            return $model;
        }

        $typeName = Type::of($this->prototype());

        throw new ResourceNotFoundException("$typeName #$id not found.");
    }
397837
private function findNode($id)
    {
        $node = $this->get('clastic.node_manager')
            ->loadNode($id);

        if (!$node) {
            throw new NotFoundHttpException();
        }

        return $node;
    }
751176
public function getOrFail($id)
    {
        if ($model = $this->get($id)) {
            return $model;
        }

        throw (new NotFoundException("No results for id $id"))->setModel(get_class($this->model));
    }
625300
public function actionQuery($id)
    {
        Yii::$app->response->format = Response::FORMAT_JSON;
        $payment = $this->findModel($id);
        if (!$this->module->hasGateway($payment->gateway)) {
            throw new NotFoundHttpException("Unknown payment gateway '{$payment->payment}'");
        }
        /** @var \yuncms\payment\BaseGateway $gateway */
        $gateway = $this->module->getGateway($payment->gateway);
        $status = $gateway->queryOrder($payment->id);
        if ($status) {
            return ['status' => 'success'];
        } else {
            return ['status' => 'pending'];
        }
    }
214781
protected function getComment($id)
    {
        $comment = $this->commentManager->find($id);

        if (null === $comment) {
            throw new NotFoundHttpException(sprintf('Comment (%d) not found', $id));
        }

        return $comment;
    }