8 * Это класс модели для таблицы регионов '{{%regions}}'.
10 * @property int $id Идентификатор региона (неизменяемое)
11 * @property string $name Наименование региона (подразделения)
12 * @property string $lname Наименование места/размещения
13 * @property int $icount Количество предметов/оборудования в регионе/подразделении
14 * @property int $icount Количество проинвентаризарованных предметов/оборудования в регионе/подразделении
16 * @property Locations[] $locations Места/размежения
17 * @property Items[] $items Предметы/оборудование
19 class Regions extends \yii\db\ActiveRecord
27 public static function tableName()
29 return '{{%regions}}';
35 public function rules()
38 [['name'], 'required'],
39 [['name'], 'string', 'max' => 120],
47 public function attributeLabels()
50 'id' => Yii::t('app', 'Identifier'),
51 'name' => Yii::t('regions', 'Region'),
52 'icount' => Yii::t('items', 'Total items count'),
53 'ccount' => Yii::t('items', 'Total items checked'),
58 * Выполнение запроса для [[Locations]].
60 * @return \yii\db\ActiveQuery
62 public function getLocations()
64 return $this->hasMany(Locations::className(), [ 'region_id' => 'id' ]);
68 * Выполнение запроса для [[Items]].
70 * @return \yii\db\ActiveQuery
72 public function getMoving()
74 return $this->getLocations()->select(Moving::tableName() . '.*')->joinWith('moving');
76 public function getItems()
78 return $this->getMoving()->select(Items::tableName() . '.*')->joinWith('items');