phpmodelyii2crudgii

error create model in CRUD generator gii yii2 framework


I have created a model class using Model generator Gii with namespace common\models\Artikel and there is no error but when I'm trying to create a model class using CRUD generator Gii, there is a error like this:

enter image description here

In my Models folder there is folder again named Artikel and then on artikel.php have that namespace common\models\Artikel. But I don't know why I get this error using CRUD generator.


Solution

  • Declaration of this class should be in common/models/Artikel.php and inside of it you should have:

    namespace common\models;
    
    class Artikel extends \yii\db\ActiveRecord {
        // ...
    }
    

    Artikel Should not be part of the namespace, it is class name.