8 * Это класс модели типов.
10 * @property int $id Идентификатор типа (неизменяемое)
11 * @property string|null $name наименование типа оборудования
12 * @property int $icount Количество предметов/оборудования для конкретного типа
13 * @property int $ccount Количество проинвентаризированных предметов/оборудования для конкретного типа
14 * @property string|null $tname Наименование типа оборудования
16 * @property Items[] $items
18 class Types extends \yii\db\ActiveRecord
26 public static function tableName()
34 public function rules()
37 [[ 'id' ], 'integer' ],
38 [[ 'name' ], 'string', 'max' => 100, ],
39 [[ 'name' ], 'required' ],
46 public function attributeLabels()
49 'id' => Yii::t('app', 'Identifire'),
50 'name' => Yii::t('types', 'Type'),
51 'tname' => Yii::t('types', 'Types'),
52 'icount' => Yii::t('items', 'Total items count'),
53 'ccount' => Yii::t('items', 'Total items checked')
58 * Gets query for [[Items]].
60 * @return \yii\db\ActiveQuery
62 public function getModels()
64 return $this->hasMany(Models::className(), [ 'type_id' => 'id' ]);
67 public function getItems()
69 return $this->getModels()->select(Items::tableName() . '.*')->joinWith('items');