schmunk42 / yii2-giiant

Yii 2 Framework Code Generator Gii on Steroids
271 stars 120 forks source link

Not found table error when using base model differ from yii\db\ActiveRecord #221

Open StalkAlex opened 6 years ago

StalkAlex commented 6 years ago

Our models are using AuditActiveRecord as base class instead of default Yii version yii\db\ActiveRecord. AuditActiveRecord just overrides basic framework version and adds audit behavior, it cannot have db table. Generator thinks otherwise:)

default

schmunk42 commented 6 years ago

Does AuditActiveRecord define a relation or a default table name? Can you show its source?

StalkAlex commented 6 years ago
use PHPKitchen\Domain\DB\Record;

class AuditActiveRecord extends Record
{
    public function behaviors()
    {
        return [
            'AuditTrailBehavior' => [
                'class'=>'bedezign\yii2\audit\AuditTrailBehavior',
                'active' => true,
                'dateFormat' => 'Y-m-d H:i:s',
            ]
        ];
    }
}

Maybe problem with php-kitchen extension and its base class