2024-08-19 14:44:16 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace app\models;
|
|
|
|
|
|
|
|
use Yii;
|
|
|
|
use yii\db\ActiveQuery;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This is the model class for table "parameters".
|
|
|
|
*
|
|
|
|
* @property int $id
|
|
|
|
* @property string $title
|
|
|
|
* @property int $type
|
|
|
|
*/
|
|
|
|
class Parameter extends \yii\db\ActiveRecord
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* {@inheritdoc}
|
|
|
|
*/
|
|
|
|
public static function tableName()
|
|
|
|
{
|
|
|
|
return 'parameters';
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getIcon()
|
|
|
|
{
|
2024-08-20 15:35:42 +02:00
|
|
|
return $this->hasOne(Image::class, [ 'id' => 'icon_id' ]);
|
2024-08-19 14:44:16 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public function getIconGray()
|
|
|
|
{
|
2024-08-20 15:35:42 +02:00
|
|
|
return $this->hasOne(Image::class, [ 'id' => 'icon_gray_id' ]);
|
2024-08-19 14:44:16 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* {@inheritdoc}
|
|
|
|
*/
|
|
|
|
public function rules()
|
|
|
|
{
|
|
|
|
return [
|
|
|
|
[['title', 'type'], 'required'],
|
2024-08-20 07:53:49 +02:00
|
|
|
[['type'], 'integer', 'min' => 1, 'max' => 2],
|
2024-08-19 14:44:16 +02:00
|
|
|
[['title'], 'string', 'max' => 255],
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* {@inheritdoc}
|
|
|
|
*/
|
|
|
|
public function attributeLabels()
|
|
|
|
{
|
|
|
|
return [
|
|
|
|
'id' => 'ID',
|
|
|
|
'title' => 'Title',
|
|
|
|
'type' => 'Type (either 1 or 2)',
|
|
|
|
'icon' => 'Icon',
|
|
|
|
'icon_gray' => 'Gray icon',
|
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|