Добрый день, подскажите, пожалуйста, в чем проблема.
yii2 - basic
console.php
$params = require(__DIR__ . '/params.php');
$db = require(__DIR__ . '/db.php');
$config = [
'id' => 'basic-console',
'name' => 'Инвестиционные проекты России - информационный портал',
'basePath' => dirname(__DIR__),
'bootstrap' => ['log'],
'controllerNamespace' => 'app\commands',
'components' => [
'cache' => [
'class' => 'yii\caching\FileCache',
],
'log' => [
'targets' => [
[
'class' => 'yii\log\FileTarget',
'levels' => ['error', 'warning'],
],
],
],
'db' => $db,
],
'params' => $params,
/*
'controllerMap' => [
'fixture' => [ // Fixture generation command line.
'class' => 'yii\faker\FixtureController',
],
],
*/
];
if (YII_ENV_DEV) {
// configuration adjustments for 'dev' environment
$config['bootstrap'][] = 'gii';
$config['modules']['gii'] = [
'class' => 'yii\gii\Module',
];
}
controller:
yii/commands/
<?php
namespace app\commands;
use Yii;
use yii\console\Controller;
use yii\commands\models\Maildelivery;
class MaildeliveryController extends Controller
{
public $models_delivery;
public function actionIndex()
{
$this -> models_delivery = new Maildelivery();
//$this -> time_now = time();
}
}
модель:
commands/models/
namespace app\commands\models;
//namespace yii\helpers;
use Yii;
use yii\base\Model;
use yii\helpers\ArrayHelper;
class Maildelivery extends \yii\db\ActiveRecord
{
public $table_name_logs = 'logs_sendmail';
public static function tableName()
{
return 'list';
}
}
запускаю в консоли:
php yii maildelivery
PHP Fatal error: Class 'yii\commands\models\Maildelivery' not found in /var/www/html/commands/MaildeliveryController.php on line 141