/
v.bolshakov
/
AIEcosystem-Testing
Обзор
Документация
Войти
/
v.bolshakov
/
AIEcosystem-Testing
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
dev
common/models/SubjectArea.php
97 строк
2 KB
Developer
Initial commit
03 авг 2026, 17:43
03 авг 2026, 17:43
7433917
Код
Авторство
О чём код?
<?php namespace common\models; use common\behaviors\CloneBehavior; use common\helpers\UuidHelper; use common\interfaces\TitleInterface; use common\traits\TitleRecordTrait; use common\validators\UidValidator; use Yii; use yii\helpers\ArrayHelper; /** * Таблица - тематики * * @property string $title Заголовок * * @author Dmitry E. Semenov <sde.tomsk@gmail.com> * @copyright Self (c) 2024 */ class SubjectArea extends \common\models\base\BaseModel implements TitleInterface { use TitleRecordTrait; /** * @inheritdoc */ public $softDelete = true; /** * {@inheritdoc} */ public static function tableName() { return 'subject_area'; } /** * {@inheritdoc} */ public function rules() { return ArrayHelper::merge(parent::rules(), [ ['guid', 'default', 'value' => UuidHelper::uuid()], ['title', 'trim'], [['title', 'guid'], 'required'], [['title'], 'string', 'max' => 255], ['guid', UidValidator::class], ['guid', 'unique'] ]); } /** * {@inheritdoc} */ public function attributeLabels() { return ArrayHelper::merge(parent::attributeLabels(), [ 'title' => Yii::t('app', 'Title'), ]); } /** * {@inheritdoc} */ public function behaviors() { return ArrayHelper::merge(parent::behaviors(), [ 'CloneBehavior' => [ 'class' => CloneBehavior::class, 'copy_self' => true, 'default_values' => [ 'guid' => null, ], ], ]); } /** * {@inheritdoc} */ public function __toString() { return $this->title; } /** * {@inheritdoc} */ public function fields() { return [ 'guid', 'title', ]; } }