ks465 / yii2-utils

A pack of multiple components and widgets, especially designed for simpler and more generic coding
GNU General Public License v2.0
0 stars 0 forks source link

ActionColumn #63

Closed ks465 closed 5 years ago

ks465 commented 5 years ago

For situations that the data model does not contain created* and updated*:

   public function init()
    {
        if (isset(Yii::$app->user->isSuperAdmin) and Yii::$app->user->isSuperAdmin) {
            if ($model instanceof KHanModel or is_array($model)) {
                $this->audit = true;
            }else {
                $this->audit = false;
            }
        }
...

Line 247 when the model does not extend KHanModel:

   } else {
        return 'ساختار جدول این گزینه را پشتیبانی نمی‌کند.';
        throw new \Exception('Model for ActionColumn should inherit ' . KHanModel::class);
    }
ks465 commented 5 years ago

The change in the init method is wrong. $model is not defined at this point. Maybe it is better to remove enforcement all together.

ks465 commented 5 years ago

The exception replace by the suggested return statement.