hasOne(Device::className(), ['id' => 'device_id']); } /** * @inheritdoc */ public function init() { $this->type = static::getType(); parent::init(); } /** * @throws NotSupportedException */ public static function find() { throw new NotSupportedException('Item query is not defined'); } /** * @inheritdoc */ public function beforeSave($insert) { $this->type = static::getType(); return parent::beforeSave($insert); } }