Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I got an error when I execute "build-rest-doc" with yii console #15

Closed
cncap opened this issue Oct 27, 2016 · 1 comment
Closed

I got an error when I execute "build-rest-doc" with yii console #15

cncap opened this issue Oct 27, 2016 · 1 comment

Comments

@cncap
Copy link

cncap commented Oct 27, 2016

`$ ./yii build-rest-doc/run
Exception 'yii\base\InvalidCallException' with message 'Setting read-only property: yii\console\Application::view'

Stack trace:
#0 /home/v/sites/yii2adv/vendor/yiisoft/yii2/BaseYii.php(521): yii\base\Component->__set('view', Array)
#1 /home/v/sites/yii2adv/vendor/yiisoft/yii2/base/Object.php(105): yii\BaseYii::configure(Object(yii\console\Application), Array)
#2 /home/v/sites/yii2adv/vendor/yiisoft/yii2/base/Application.php(206): yii\base\Object->__construct(Array)
#3 /home/v/sites/yii2adv/vendor/yiisoft/yii2/console/Application.php(89): yii\base\Application->__construct(Array)
#4 /home/v/sites/yii2adv/yii(26): yii\console\Application->__construct(Array)
#5 {main}

I've already set up twig and installed slate like #8 said. Can you help me to analyze the problem where it is?thank you @pahanini

@cncap cncap changed the title I get an error when I execute "build-rest-doc" with yii console I got an error when I execute "build-rest-doc" with yii console Oct 27, 2016
@cncap
Copy link
Author

cncap commented Oct 27, 2016

This problem has been solved, I refer to the official TWIG note, the "view" block should be placed inside the components:
[
'components' => [
'view' => [
'class' => 'yii\web\View',
'renderers' => [
'twig' => [
'class' => 'yii\twig\ViewRenderer',
'cachePath' => '@runtime/Twig/cache',
// Array of twig options:
'options' => [
'auto_reload' => true,
],
'globals' => ['html' => '\yii\helpers\Html'],
'uses' => ['yii\bootstrap'],
],
// ...
],
],
],
]

@cncap cncap closed this as completed Oct 27, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant