mirror of
https://github.com/CyanoFresh/SmartHomePHP.git
synced 2026-03-03 00:24:01 +01:00
61 lines
1.0 KiB
PHP
61 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace app\models;
|
|
|
|
use Yii;
|
|
use yii\helpers\ArrayHelper;
|
|
|
|
/**
|
|
* This is the model class for table "task".
|
|
*
|
|
* @property integer $id
|
|
* @property string $name
|
|
*
|
|
* @property TaskAction[] $taskActions
|
|
*/
|
|
class Task extends \yii\db\ActiveRecord
|
|
{
|
|
/**
|
|
* @inheritdoc
|
|
*/
|
|
public static function tableName()
|
|
{
|
|
return 'task';
|
|
}
|
|
|
|
/**
|
|
* @inheritdoc
|
|
*/
|
|
public function rules()
|
|
{
|
|
return [
|
|
[['name'], 'required'],
|
|
[['name'], 'string', 'max' => 255],
|
|
];
|
|
}
|
|
|
|
/**
|
|
* @inheritdoc
|
|
*/
|
|
public function attributeLabels()
|
|
{
|
|
return [
|
|
'id' => 'ID',
|
|
'name' => 'Name',
|
|
];
|
|
}
|
|
|
|
/**
|
|
* @return \yii\db\ActiveQuery
|
|
*/
|
|
public function getTaskActions()
|
|
{
|
|
return $this->hasMany(TaskAction::className(), ['task_id' => 'id']);
|
|
}
|
|
|
|
public static function getList()
|
|
{
|
|
return ArrayHelper::map(self::find()->all(), 'id', 'name');
|
|
}
|
|
}
|