Browse Source

ModuleRecord entity add system property

master
Egorka 6 years ago
parent
commit
7f7cd1fa89
  1. 37
      core/entities/ModuleRecord.php

37
core/entities/ModuleRecord.php

@ -4,7 +4,6 @@ namespace core\entities;
use core\entities\queries\ModuleRecordQuery;
/**
* This is the model class for table "modules".
*
@ -13,13 +12,17 @@ use core\entities\queries\ModuleRecordQuery;
* @property string $class
* @property string $type
* @property int $active
* @property int $system
*/
class ModuleRecord extends \yii\db\ActiveRecord
{
const STATUS_ENABLED = 1;
const STATUS_DISABLED = 0;
const STATUS_ENABLED = 1;
const STATUS_DISABLED = 0;
const SYSTEM_YES = 1;
const SYSTEM_NO = 0;
public $description;
public $description;
/**
* @inheritdoc
@ -37,7 +40,7 @@ class ModuleRecord extends \yii\db\ActiveRecord
return [
[['name', 'class', 'type'], 'required'],
[['name', 'class', 'type'], 'string', 'max' => 255],
['active', 'integer'],
['active', 'integer'],
[['name'], 'unique'],
];
}
@ -48,25 +51,25 @@ class ModuleRecord extends \yii\db\ActiveRecord
public function attributeLabels()
{
return [
'id' => 'ID',
'name' => 'Name',
'id' => 'ID',
'name' => 'Name',
'class' => 'Class',
'type' => 'Type',
'type' => 'Type',
];
}
public function isEnabled(): bool
{
return $this->active == $this::STATUS_ENABLED;
return $this->active == $this::STATUS_ENABLED;
}
public function isDisabled(): bool
{
return $this->active == $this::STATUS_DISABLED;
}
public function isDisabled(): bool
{
return $this->active == $this::STATUS_DISABLED;
}
public static function find(): ModuleRecordQuery
{
return new ModuleRecordQuery(static::class);
}
public static function find(): ModuleRecordQuery
{
return new ModuleRecordQuery(static::class);
}
}

Loading…
Cancel
Save