public function Lista() { $sql = "SELECT * FROM banners"; $stmt = $this->conexao->prepare($sql); $stmt->execute(); $searchResults = array(); while ($rs = $stmt->fetch(PDO::FETCH_OBJ)) { $temp = new Banner(); $temp->setIdbanner($rs->idbanner); $temp->setIdDepartamento($rs->iddepartamento); $temp->setLado($rs->lado); $temp->setNumero($rs->numero); $temp->setBanner($rs->banner); $temp->setDescricao($rs->descricao); $temp->setWidth($rs->width); $temp->setHeight($rs->height); $temp->setUrl($rs->url); $temp->setTarget($rs->target); $temp->setClick($rs->click); $temp->setData($rs->data); $temp->setExtensao($rs->banner); array_push($searchResults, $temp); } if(count($searchResults) > 1) { return $searchResults; } else { return $temp; } }