100], [['title', 'key'], 'string', 'max' => 255], [['key'], 'unique'], [['room_id'], 'exist', 'skipOnError' => true, 'targetClass' => Room::className(), 'targetAttribute' => ['room_id' => 'id']], ]; } /** * @inheritdoc */ public function attributeLabels() { return [ 'id' => 'ID', 'type' => 'Type', 'room_id' => 'Room ID', 'name' => 'Name', 'title' => 'Title', 'key' => 'Key', 'allow_remote_connection' => 'Allow Remote Connection', ]; } /** * @return \yii\db\ActiveQuery */ public function getRoom() { return $this->hasOne(Room::className(), ['id' => 'room_id'])->inverseOf('devices'); } /** * @inheritdoc * @return \app\models\query\DeviceQuery the active query used by this AR class. */ public static function find() { return new \app\models\query\DeviceQuery(get_called_class()); } }