<?php /** * Created by Error202 * Date: 04.06.2018 */ namespace core\entities; /** * @property integer $id * @property string $type * @property string $section * @property string $key * @property string $value * @property integer $active * @property integer $created_at * @property integer $updated_at */ use Yii; use yii\db\ActiveRecord; use yii\behaviors\TimestampBehavior; class Settings extends ActiveRecord { public static function tableName(): string { return '{{%settings}}'; } public function attributeLabels() { return [ 'id' => Yii::t('main', 'ID'), 'type' => Yii::t('main', 'Type'), 'section' => Yii::t('main', 'Section'), 'key' => Yii::t('main', 'Key'), 'value' => Yii::t('main', 'Value'), 'active' => Yii::t('main', 'Active'), 'created_at' => Yii::t('main', 'Created At'), 'updated_at' => Yii::t('main', 'Updated At'), ]; } public static function create($type, $section, $key, $value, $active): self { $settings = new static(); $settings->type = $type; $settings->section = $section; $settings->key = $key; $settings->value = $value; $settings->active = $active; return $settings; } public function edit($type, $section, $key, $value, $active): void { $this->type = $type; $this->section = $section; $this->key = $key; $this->value = $value; $this->active = $active; } public function behaviors(): array { return [ TimestampBehavior::class, ]; } }