0.5, 'max' => 5, ], ]; } public function behaviors() { return [ [ 'class' => TimestampBehavior::className(), ], [ 'class' => BlameableBehavior::className(), 'createdByAttribute' => 'customer_id', 'updatedByAttribute' => false, ], ]; } /** * @inheritdoc */ public function attributeLabels() { return [ 'id' => Yii::t('app', 'Rating ID'), 'created_at' => Yii::t('app', 'Date Add'), 'updated_at' => Yii::t('app', 'Date Update'), 'customer_id' => Yii::t('app', 'User ID'), 'entity' => Yii::t('app', 'Entity'), 'value' => Yii::t('app', 'Value'), ]; } /** * Get entity model for current model * * @return \yii\db\ActiveQuery|null */ public function getModel() { $model = $this->model; if (method_exists($model, 'primaryKey')) { /** * @var ActiveRecord $model */ return $this->hasOne($model, [ $model::primaryKey()[ 0 ] => 'model_id' ]); } else { return null; } } }