(non-PHPdoc)
@see \Zend\Mvc\Controller\AbstractActionController::createHttpNotFoundModel()
193846
protected function createHttpNotFoundModel(HttpResponse $response)
	{
		$response->setStatusCode(404);
		$this->view->content = 'Page not found';
		return $this->view;
	}
973647
protected function findModel($id)
    {
        $commentModel = $this->getModule()->commentModelClass;
        if (null !== ($model = $commentModel::findOne($id))) {
            return $model;
        } else {
            throw new NotFoundHttpException(Yii::t('yii2mod.comments', 'The requested page does not exist.'));
        }
    }
239342
protected function findModel($id)
    {
        $class = $this->modelClass;
        if (($model = $class::findOne($id)) !== null) {
            return $model;
        } else {
            throw new NotFoundHttpException('The requested page does not exist.');
        }
    }
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.'));
        }
    }
245308
protected function createModel()
    {
        $model = new SearchPanelModel();

        $model->searchControls = $this->createSearchControls();

        $model->urlStateNames = $this->getUrlStateNames($model->searchControls);

        // Pass through of searchedEvent
        $this->searchedEvent = $model->searchedEvent;

        return $model;
    }
781251
private function setNotFound()
    {
        $this->config['controller_name'] = class_exists('\App\Controller\ErrorController') ? '\App\Controller\ErrorController' : '\Bone\Mvc\Controller';
        $this->config['action_name'] = 'notFoundAction';
        $this->config['controller'] = 'error';
        $this->config['action'] = 'not-found';
        $this->controller = new $this->config['controller_name']($this->request);
        $this->controller->setServerEnvironment($this->getEnv());
        $this->response = $this->response->withStatus(404);
    }
704704
public function run($id)
    {
        /** @var ActiveRecord $model */
        $model = new $this->modelClass;

        /*
         * Locate the supplied model, left, right and parent models
         */
        $pkAttribute = $model->getTableSchema()->primaryKey[0];

        /** @var ActiveRecord|NestedSetsBehavior $model */
        $model = $model::find()->where([$pkAttribute => $id])->one();

        if ($model == null) {
            throw new NotFoundHttpException('Node not found');
        }

        $name = Yii::$app->request->post('name');
        $model->{$this->nameAttribute} = $name;
        if (!$model->validate()) {
            throw new HttpException($model->getFirstError($this->nameAttribute));
        }
        $model->update(true, [$this->nameAttribute]);

        return null;
    }
912616
public function newAction(Request $request)
    {
        /** @var ConfiguratorFactory $configuratorFactory */
        $configuratorFactory = $this->getConfiguratorFactory($this->getClassName());
        /** @var CrudConfigurator $crudConfigurator */
        $crudConfigurator = $configuratorFactory->getConfigurator(CrudConfigurator::class);

        $this->isGrantedOr404Error($crudConfigurator, Constants::ACTION_CREATE);

        /** @var PluginConfigurator $pluginConfigurator */
        $pluginConfigurator = $configuratorFactory->getConfigurator(PluginConfigurator::class);
        $template = $pluginConfigurator->isBulkInsertEnabled() ? $crudConfigurator->getTemplate()->getBulkCreate() : $crudConfigurator->getTemplate()->getCreate();

        $modelClass = $crudConfigurator->getCrud()->getModelClass();
        $model = new $modelClass();
        $form = $crudConfigurator->getForm($model);

        return $this->createOrUpdate($request, $model, $form, Constants::ACTION_CREATE, $template);
    }
246615
private function notFoundResponse() {
        $responseMessage = new Swagger\ResponseMessage();
        $responseMessage->setCode(404);
        $responseMessage->setMessage(ucfirst($this->getModel()->getSource()) . ' not found.');

        return $responseMessage;
    }
96819
public function editAction(Request $request)
    {
        $user = $this->getUser();
        $repository = $this->get('ekyna_user.address.repository');

        if (null === $address = $repository->find($request->attributes->get('addressId'))) {
            throw new NotFoundHttpException('Address not found.');
        }
        if ($address->getUser()->getId() !== $user->getId()) {
            throw new AccessDeniedHttpException('Access denied');
        }

        $cancelPath = $this->generateUrl('ekyna_user_address_list');

        /** @var \Symfony\Component\Form\FormInterface $form */
        $form = $this
            ->createForm('ekyna_user_address', $address, [
                '_redirect_enabled' => true,
            ])
            ->add('actions', 'form_actions', [
                'buttons' => [
                    'save' => [
                        'type' => 'submit', 'options' => [
                            'button_class' => 'primary',
                            'label' => 'ekyna_core.button.save',
                            'attr' => [
                                'icon' => 'ok',
                            ],
                        ],
                    ],
                    'cancel' => [
                        'type' => 'button', 'options' => [
                            'label' => 'ekyna_core.button.cancel',
                            'button_class' => 'default',
                            'as_link' => true,
                            'attr' => [
                                'class' => 'form-cancel-btn',
                                'icon' => 'remove',
                                'href' => $cancelPath,
                            ],
                        ],
                    ],
                ],
            ])
        ;

        $form->handleRequest($request);
        if ($form->isValid()) {
            $event = $this->get('ekyna_user.address.operator')->update($address);
            if (!$event->isPropagationStopped()) {
                $this->addFlash('ekyna_user.address.message.edit.success', 'success');
                if (null !== $redirectPath = $form->get('_redirect')->getData()) {
                    return $this->redirect($redirectPath);
                }
                return $this->redirect($cancelPath);
            }
            $this->addFlash('ekyna_user.address.message.edit.failure', 'danger');
        }

        return $this->render('EkynaUserBundle:Address:edit.html.twig', [
            'address' => $address,
            'form' => $form->createView()
        ]);
    }
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.');
        }
    }
1143200
protected function findModel($id) {
    $user = User::findIdentity($id);
    if ($user === null) {
      throw new NotFoundHttpException('The requested page does not exist');
    }

    return $user;
  }
612172
public function createAction(Request $request)
    {
        if (!$request->isXmlHttpRequest()) {
            throw new NotFoundHttpException();
        }

        $refFolder = $this->findFolderById($request->attributes->get('id'));
        $repo = $this->getFolderRepository();

        $newFolder = $repo->createNew();
        $newFolder->setName('New folder');

        $mode = strtolower($request->request->get('mode'));
        if (!in_array($mode, array('child', 'after'))) {
            $response = new Response(json_encode(array(
                'error'   => true,
                'message' => 'Unexpected creation mode.',
            ), JSON_FORCE_OBJECT));
        } else {
            if ($mode === 'after') {
                $repo->persistAsNextSiblingOf($newFolder, $refFolder);
            } else {
                $repo->persistAsFirstChildOf($newFolder, $refFolder);
            }

            if (true !== $message = $this->validateFolder($newFolder)) {
                $response = new Response(json_encode(array(
                    'error'   => true,
                    'message' => $message,
                ), JSON_FORCE_OBJECT));
            } else {
                $this->getEntityManager()->flush();
                $data = $this->get('jms_serializer')->serialize(
                    $newFolder,
                    'json',
                    SerializationContext::create()->setGroups(array('Manager'))
                );
                $response = new Response(sprintf('{"node":%s}', $data));
            }
        }

        $response->headers->add(array('Content-Type' => 'application/json'));
        return $response;
    }
1014621
protected function findModel($id)
    {
        $class = $this->userClassName;
        if (($user = $class::findIdentity($id)) !== null) {
            return new Assignment($id, $user);
        } else {
            throw new NotFoundHttpException('The requested page does not exist.');
        }
    }
1105815
public function actionView($name = '')
    {
        if ($name == '') {
            $name = yii::$app->getRequest()->getPathInfo();
        }
        $model = Article::findOne(['type' => Article::SINGLE_PAGE, 'sub_title' => $name]);
        if (empty($model)) {
            throw new NotFoundHttpException('None page named ' . $name);
        }
        return $this->render('view', [
            'model' => $model,
        ]);
    }
174001
protected function findModel($id)
    {
        if (($model = TermOfProductType::findOne($id)) !== null) {
            return $model;
        } else {
            throw new NotFoundHttpException(t('app', 'The requested page does not exist.'));
        }
    }
667063
public function createMediaAction(Request $request)
    {
        if (!$request->isXmlHttpRequest()) {
            throw new NotFoundHttpException();
        }

        $folderId = $request->attributes->get('id');
        $folder = $this->findFolderById($folderId);

        $upload = new MediaUpload();

        $form = $this->createForm('ekyna_media_upload', $upload, array(
            'action' => $this->generateUrl(
                'ekyna_media_browser_admin_create_media',
                array('id' => $folderId)
            ),
            'method' => 'POST',
            'attr'   => array(
                'class' => 'form-horizontal form-with-tabs',
            ),
            'folder' => $folder,
        ));

        $modal = $this->createModal();
        $modal->setTitle('ekyna_media.upload.title');
        $modal->setVars(array(
            'form_template' => 'EkynaMediaBundle:Manager:upload.html.twig',
        ));

        $success = false;
        $form->handleRequest($request);
        if ($form->isValid()) {
            $success = true;
            // TODO use ResourceManager
            foreach ($upload->getMedias() as $media) {
                $event = $this->get('ekyna_media.media.operator')->create($media);
                if ($event->hasErrors()) {
                    $success = false;
                    break;
                }
            }
        }
        if ($success) {
            $modal->setContent(array('success' => true));
        } else {
            $modal->setContent($form->createView());
        }

        return $this->get('ekyna_core.modal')->render($modal);
    }