kakalos12
(Kakalos12)
January 26, 2014, 11:23am
1
Hi all,
I have a difficulty trying to use the fixture. After adding “yiisoft/yii2-faker”: “*” to composer.json, and setting ‘tests’ in main.php for console app (I’m using advanced template), I run the faker with this command : “php yii fixture users”. It return an error :
PHP Fatal error: Trait ‘yii\console\controllers\DbTestTrait’ not found in /home/dong/workspace/bussinessbuilder/vendor/yiisoft/yii2/console/controllers/FixtureController.php on line 55
exception ‘yii\base\ErrorException’ with message ‘Trait ‘yii\console\controllers\DbTestTrait’ not found’ in /home/dong/workspace/bussinessbuilder/vendor/yiisoft/yii2/console/controllers/FixtureController.php:55
Stack trace:
#0 [internal function]: yii\base\Application->handleFatalError()
#1 {main}
exception ‘yii\base\ErrorException’ with message ‘Trait ‘yii\console\controllers\DbTestTrait’ not found’ in /home/dong/workspace/bussinessbuilder/vendor/yiisoft/yii2/console/controllers/FixtureController.php:55
Stack trace:
#0 [internal function]: yii\base\Application->handleFatalError()
#1 {main}
Any ideas how to fix this.
Thanks all so much.
Ragazzo
(Godlike Man)
January 26, 2014, 4:47pm
2
Hi, yeah, this is because fixture controller for faker is extended from yii console fixture controller, that is using trait that was removed. As a quick fix you can simply remove this row (https://github.com/yiisoft/yii2/blob/master/framework/console/controllers/FixtureController.php#L55 ) from you code in vendor dir.
I will have time tomorrow to fix yii\console\FixtureController according last changes in fixture features, because they were completle redesigned and now there is no DbFixtureManager.
kakalos12
(Kakalos12)
January 27, 2014, 10:36am
3
Ragazzo:
Hi, yeah, this is because fixture controller for faker is extended from yii console fixture controller, that is using trait that was removed. As a quick fix you can simply remove this row (https://github.com/yiisoft/yii2/blob/master/framework/console/controllers/FixtureController.php#L55 ) from you code in vendor dir.
I will have time tomorrow to fix yii\console\FixtureController according last changes in fixture features, because they were completle redesigned and now there is no DbFixtureManager.
Thanks Ragazzo, I’ll wait for your fix.
kakalos12
(Kakalos12)
January 28, 2014, 6:52am
4
Ragazzo,
have you fixed this? If I remove that line, it generate another error,
exception ‘yii\base\UnknownMethodException’ with message ‘Calling unknown method: yii\console\controllers\FixtureController::getFixtureManager()’ in /home/dong/workspace/bussinessbuilder/vendor/yiisoft/yii2/base/Component.php:204
Stack trace:
#0 /home/dong/workspace/bussinessbuilder/vendor/yiisoft/yii2/console/controllers/FixtureController.php(114): yii\base\Component->__call(‘getFixtureManag…’, Array)
#1 /home/dong/workspace/bussinessbuilder/vendor/yiisoft/yii2/console/controllers/FixtureController.php(114): yii\console\controllers\FixtureController->getFixtureManager()
#2 [internal function]: yii\console\controllers\FixtureController->actionApply(Array, Array)
#3 /home/dong/workspace/bussinessbuilder/vendor/yiisoft/yii2/base/InlineAction.php(53): call_user_func_array(Array, Array)
#4 /home/dong/workspace/bussinessbuilder/vendor/yiisoft/yii2/base/Controller.php(128): yii\base\InlineAction->runWithParams(Array)
#5 /home/dong/workspace/bussinessbuilder/vendor/yiisoft/yii2/console/Controller.php(77): yii\base\Controller->runAction(’’, Array)
#6 /home/dong/workspace/bussinessbuilder/vendor/yiisoft/yii2/base/Module.php(586): yii\console\Controller->runAction(’’, Array)
#7 /home/dong/workspace/bussinessbuilder/vendor/yiisoft/yii2/console/Application.php(131): yii\base\Module->runAction(‘fixture’, Array)
#8 /home/dong/workspace/bussinessbuilder/vendor/yiisoft/yii2/console/Application.php(99): yii\console\Application->runAction(‘fixture’, Array)
#9 /home/dong/workspace/bussinessbuilder/vendor/yiisoft/yii2/base/Application.php(289): yii\console\Application->handleRequest(Object(yii\console\Request))
#10 /home/dong/workspace/bussinessbuilder/yii(27): yii\base\Application->run()
#11 {main}
Please take time to review it. Thanks,
Ragazzo
(Godlike Man)
January 31, 2014, 7:36am
5
Nope, not yet. We are thinking of different approaches for fixing FixtureController, maybe will remove it, after that Faker will be fixed.
Ragazzo
(Godlike Man)
February 4, 2014, 4:10pm
6
FixtureController also was fixed, docs updated, some actions were renamed: apply/clear -> load/unload.