Answer the question
In order to leave comments, you need to log in
Yii2 console application class not found error?
Good afternoon, tell me, please, what is the problem.
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',
];
}
<?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();
}
}
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';
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question