V
V
Vyacheslav Soldatov2022-02-15 19:08:49
Yii
Vyacheslav Soldatov, 2022-02-15 19:08:49

View not Found - yii\base\ViewNotFoundException how to understand?

yii\base\ViewNotFoundException: The view file does not exist: C:\OpenServer\domains\medicalcentr\modules\admin\views\application\index.php in C:\OpenServer\domains\medicalcentr\vendor\yiisoft\yii2\base \View.php:233
Stack trace:
#0 C:\OpenServer\domains\medicalcentr\vendor\yiisoft\yii2\base\View.php(156): yii\base\View->renderFile('C:\\OpenServer \\d...', Array, Object(app\modules\admin\controllers\ApplicationController))
#1 C:\OpenServer\domains\medicalcentr\vendor\yiisoft\yii2\base\Controller.php(407): yii \base\View->render('index', Array, Object(app\modules\admin\controllers\ApplicationController))

{
$viewFile = $requestedFile = Yii::getAlias($viewFile);

if ($this->theme !== null) {
$viewFile = $this->theme->applyTo($viewFile);
}
if (is_file($viewFile)) {
$viewFile = FileHelper::localize($viewFile);
} else {
throw new ViewNotFoundException("The view file does not exist: $viewFile");
}

$oldContext = $this->context;
if ($context !== null) {
$this->context = $context;
}
$output = '';
$this->_viewFiles[] = [
'resolved' => $viewFile,

#2 C:\OpenServer\domains\medicalcentr\modules\admin\controllers\ApplicationController.php(46): yii\base\Controller->render( 'index', Array)

* @throws InvalidCallException if the view cannot be resolved.
* see renderFile()
*/
public function render($view, $params = [], $context = null)
{
$viewFile = $this->findViewFile($view, $context);
return $this->renderFile($viewFile, $params, $context);
}

/**
* Finds the view file based on the given view name.
* @param string $view the view name or the [path alias](guide:concept-aliases) of the view file. Please refer to
* on how to specify this parameter.

#3 [internal function]: app\modules\admin\controllers\ApplicationController->actionIndex()

* These parameters will not be available in the layout.
* return string the rendering result.
* @throws InvalidArgumentException if the view file or the layout file does not exist.
*/
public function render($view, $params = [])
{
$content = $this->getView()->render($view, $params, $this);
return $this->renderContent($content);
}

/**
* Renders a static string by applying a layout.
* @param string $content the static string being rendered

#4 C:\OpenServer\domains\medicalcentr\vendor\yiisoft\yii2\base\InlineAction.php(57): call_user_func_array(Array, Array)

{
$searchModel = new ApplicationSearch();
$dataProvider = $searchModel->search($this->request->queryParams);

return $this->render('index', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider,
]);
}

/**
* Displays a single Application model.
* @param int $id ID

#5 C:\OpenServer\domains\medicalcentr\vendor\yiisoft\yii2\base\Controller.php(178): yii\base\InlineAction->runWithParams(Array)

#6 C:\OpenServer \domains\medicalcentr\vendor\yiisoft\yii2\base\Module.php(552): yii\base\Controller->runAction('', Array)

$args = $this->controller->bindActionParams($this,
Yii::debug('Running action: ' . get_class($this->controller) . '::' . $this->actionMethod . '()', __METHOD__);
if (Yii::$app->requestedParams === null) {
Yii::$app->requestedParams = $args;
}

return call_user_func_array([$this->controller, $this->actionMethod], $args);
}
}

#7 C:\OpenServer\domains\medicalcentr\vendor\yiisoft\yii2\web\Application.php(103): yii\base\Module->runAction('admin/applicati...', Array)
}

$ result = null;

if ($runAction && $this->beforeAction($action)) {
// run the action
$result = $action->runWithParams($params);

$result = $this->afterAction($action, $result);

// call afterAction on modules
foreach ($modules as $module) {
/* var $module Module */

#8 C:\OpenServer\domains\medicalcentr\vendor\yiisoft\yii2\base\Application.php(384): yii \web\Application->handleRequest(Object(yii\web\Request))

$parts = $this->createController($route);
if (is_array($parts)) {
/* var $controller Controller */
list($controller, $actionID) = $parts;
$oldController = Yii::$app->controller;
Yii::$app->controller = $controller;
$result = $controller->runAction($actionID, $params);
if ($oldController !== null) {
Yii::$app->controller = $oldController;
}

return $result;
}

#9 C:\OpenServer\domains\medicalcentr\web\index.php(12): yii\base\Application->run()
$params = $this->catchAll;

unset($params[0]);
}
try {
Yii::debug("Route requested: '$route'", __METHOD__);
$this->requestedRoute = $route;
$result = $this->runAction($route, $params);
if ($result instanceof Response) {
return $result;
}

$response = $this->getResponse();
if ($result !== null) {

#10 {main}
{
try {
$this->state = self::STATE_BEFORE_REQUEST;
$this->trigger(self::EVENT_BEFORE_REQUEST);

$this->state = self::STATE_HANDLING_REQUEST;
$response = $this->handleRequest($this->getRequest());

$this->state = self::STATE_AFTER_REQUEST;
$this->trigger(self::EVENT_AFTER_REQUEST);

$this->state = self::STATE_SENDING_RESPONSE;
$response->send();
11. in C:\OpenServer\domains\medicalcentr\web\index.php at line 12- yii\base\Application::run()

require __DIR__ . '/../vendor/autoload.php';
require __DIR__ . '/../vendor/yiisoft/yii2/Yii.php';

$config = require __DIR__ . '/../config/web.php';

(new yii\web\Application($config))->run();

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question