public function carrega($id) { $this->conectar(); $query = "SELECT * FROM musicas WHERE id='" . $id . "';"; $result = $this->query($query); $this->desconectar(); $this->setId($result[0]["id"]); $this->setNome($result[0]["nome"]); $this->setDuracao($result[0]["duracao"]); $banda = new Banda(); $banda->carrega($result[0]["id_banda"]); $this->setIdBanda($banda->getId()); $this->setBanda($banda->getNome()); $status = new Status(); $status->carrega($result[0]["id_status"]); $this->setStatus($status); $editavel = false; if ($result[0]["id_status"] == "1") { $editavel = true; } $votos = new Votos(); $votos->carrega($result[0]["id"], $editavel); $this->setVotos($votos); $recursos = new ListaRecursos(); $recursos->carrega($result[0]["id"]); $this->setRecursos($recursos->getRecursos()); }