You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

81 lines
1.5 KiB

7 years ago
<?php
namespace core\entities;
use core\entities\queries\ModuleRecordQuery;
7 years ago
/**
* This is the model class for table "modules".
*
* @property int $id
* @property string $name
* @property string $class
* @property string $type
* @property int $active
* @property int $system
7 years ago
*/
class ModuleRecord extends \yii\db\ActiveRecord
{
const STATUS_ENABLED = 1;
const STATUS_DISABLED = 0;
const SYSTEM_YES = 1;
const SYSTEM_NO = 0;
public $description;
7 years ago
/**
* @inheritdoc
*/
public static function tableName()
{
return '{{%modules}}';
}
/**
* @inheritdoc
*/
public function rules()
{
return [
[['name', 'class', 'type'], 'required'],
[['name', 'class', 'type'], 'string', 'max' => 255],
['active', 'integer'],
7 years ago
[['name'], 'unique'],
];
}
/**
* @inheritdoc
*/
public function attributeLabels()
{
return [
'id' => 'ID',
'name' => 'Name',
7 years ago
'class' => 'Class',
'type' => 'Type',
7 years ago
];
}
public function isEnabled(): bool
{
return $this->active == $this::STATUS_ENABLED;
}
public function isDisabled(): bool
{
return $this->active == $this::STATUS_DISABLED;
}
public function isSystem(): bool
{
return $this->system == $this::SYSTEM_YES;
}
public static function find(): ModuleRecordQuery
{
return new ModuleRecordQuery(static::class);
}
7 years ago
}