PHP Fatal Error 'yii \ base \ ErrorException' with message 'Class' app \ commands \ Yii 'not found'
in /home/c/co75701/yii2/public_html/commands/CountriesController.php:36
Stack trace:
0 [internal function]: yii \ base \ ErrorHandler-> handleFatalError () 1 {main}
Line 36 is the beginning of a 3-line query:
Yii::$app->db->createCommand()->batchInsert('countries', ['country'], $countries )->execute(); $countries - an ordinary array of countries.
use app\commands\Yii? - Bookinuse yii;or a slash before calling\Yii:$app. PS Usually IDE (PhpStorm exactly) suggest the absence of a declaration. - Ninazu$countries? Most likely the problem in this array is oakymaxuse app\commands\Yiiwithuse \Yii, if you don’t have of course the class that’s used here. If there is something or as you wrote above, or use alliances inuse. The errorInvalid argument supplied for foreach()does not apply to the question, but maybe just$countriesempty, or else there is an error. - Bookin