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

Unknown property exception upon executing migration script #14

Closed
senguttuvang opened this issue Apr 10, 2015 · 4 comments
Closed

Unknown property exception upon executing migration script #14

senguttuvang opened this issue Apr 10, 2015 · 4 comments

Comments

@senguttuvang
Copy link

I installed the settings plugin via composer, but when I'm trying to create tables using migration script, I encountered the following issue. Any idea?

C:\projects\proj>yii migrate/up --migrationPath=@vendor/pheme/yii2-settings/migrations
←[0m←[31;1mException←[0m←[0m←[1;34m 'yii\base\UnknownPropertyException'←[0m with message ←[0m←[1m'Setting unknown property: yii\console\Request::enableCsrfValidation'←[0m

in C:\projects\proj\vendor\yiisoft\yii2\base\←[0m←[1mComponent.php←[0m:←[0m←[1;33m197←[0m

←[0m←[1mStack trace:
←[0m#0 C:\projects\med-appt\vendor\yiisoft\yii2\BaseYii.php(518): yii\base\Component->__set('enableCsrfValid...', false)
#1 C:\projects\med-appt\vendor\yiisoft\yii2\base\Object.php(105): yii\BaseYii::configure(Object(yii\console\Request), Array)

C:\projects\med-appt\vendor\yiisoft\yii2\di\Container.php(372): ReflectionClass->newInstanceArgs(Array)
C:\projects\med-appt\vendor\yiisoft\yii2\di\Container.php(151): yii\di\Container->build('yii\console\Req...', Array, Array)
C:\projects\med-appt\vendor\yiisoft\yii2\BaseYii.php(344): yii\di\Container->get('yii\console\Req...', Array, Array)
C:\projects\med-appt\vendor\yiisoft\yii2\di\ServiceLocator.php(133): yii\BaseYii::createObject(Array)
C:\projects\med-appt\vendor\yiisoft\yii2\base\Application.php(536): yii\di\ServiceLocator->get('request')
C:\projects\med-appt\vendor\yiisoft\yii2\base\Application.php(375): yii\base\Application->getRequest()
C:\projects\med-appt\yii(31): yii\base\Application->run()
{main}

@senguttuvang
Copy link
Author

It's my mistake. I put enableCsrfValidation in common/config.php which led the console app to throw exception. I moved the setting to config files frontend and backend and now the migration works.

@arisk
Copy link
Contributor

arisk commented Apr 11, 2015

Good to hear it's working :)

@mohammad1381
Copy link

I have a problem like this, but this solution does not work for me.

I want to use Form Builder Extension but when I run migrate this shows.

C:\xampp\htdocs\SEPreport>yii migrate/up --migrationPath=@vendor/pceuropa/yii2-forms/migrations
Exception 'yii\base\UnknownPropertyException' with message 'Setting unknown property: yii\console\Request::enableCsrfValidation'

in C:\xampp\htdocs\SEPreport\vendor\yiisoft\yii2\base\Component.php:209

Stack trace:
#0 C:\xampp\htdocs\SEPreport\vendor\yiisoft\yii2\BaseYii.php(546): yii\base\Component->__set('enableCsrfValid...', false)
#1 C:\xampp\htdocs\SEPreport\vendor\yiisoft\yii2\base\BaseObject.php(107): yii\BaseYii::configure(Object(yii\console\Request), Array)
#2 [internal function]: yii\base\BaseObject->__construct(Array)
#3 C:\xampp\htdocs\SEPreport\vendor\yiisoft\yii2\di\Container.php(383): ReflectionClass->newInstanceArgs(Array)
#4 C:\xampp\htdocs\SEPreport\vendor\yiisoft\yii2\di\Container.php(156): yii\di\Container->build('yii\\console\\Req...', Array, Array)
#5 C:\xampp\htdocs\SEPreport\vendor\yiisoft\yii2\BaseYii.php(349): yii\di\Container->get('yii\\console\\Req...', Array, Array)
#6 C:\xampp\htdocs\SEPreport\vendor\yiisoft\yii2\di\ServiceLocator.php(137): yii\BaseYii::createObject(Array)
#7 C:\xampp\htdocs\SEPreport\vendor\yiisoft\yii2\base\Module.php(742): yii\di\ServiceLocator->get('request', true)
#8 C:\xampp\htdocs\SEPreport\vendor\yiisoft\yii2\console\Application.php(219): yii\base\Module->get('request')
#9 C:\xampp\htdocs\SEPreport\vendor\yiisoft\yii2\base\Application.php(386): yii\console\Application->getRequest()
#10 C:\xampp\htdocs\SEPreport\yii(27): yii\base\Application->run()
#11 {main}

what do I have to do? please help me

@schmunk42
Copy link
Contributor

@mohammad1381 Something in your app is using request (eg. user via session), you need to find which component is doing that and disable it for console applications. It should have nothing to do with this extension.

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

4 participants