Posts Tagged with use namespace

Displaying 1-1 of 1 result.
Resolved: Yii2 Error Exception: Class 'Custom class' not found
posted by admin on February 15, 2017
I use in migration classes custom helper class Table, and in migration up process got an error like

./yii migrate

Result until error

Yii Migration Tool (based on Yii v2.0.11.2)

Total 2 new migrations to be applied:

Apply the above migrations? (yes|no) [no]:yes
*** applying m170213_124818_init

Error Message:

Exception: Class 'yii\helpers\Table' not found (/var/www/html/basic/migrations/m170213_124818_init.php:10)

My class is in root directory in helpers directory

namespace yii\helpers;
class Table
public static $user = 'user';
public static $role = 'role';
public static $status = 'status';
public static $domain = 'domain';

In migration class

use yii\db\Migration;
use yii\helpers;

class m170213_124818_init extends Migration
public function safeUp()
/** User Create*/
$this->createTable('{{%'.helpers\Table::$user.'}}', [
'id' => $this->primaryKey(10)->notNull()->unsigned(),
. . .
], 'ENGINE=InnoDB');

How to resolve itRead more