<?php

require_once 'Conexao.class.php';

/**
 * Description of DAOSugestoes
 *
 * @author Eticons
 */
class DAOSugestoes {

    private $conexao = null;

    function __construct() {
        $this->conexao = new Conexao();
    }

    public function buscarSugestoes($query) {
        try {
            $con = $this->conexao->getConexao();
            $stmt = $con->query($query);
            $this->conexao->desconectar();
            $i = 0;
            $lista = array();
            if ($stmt) {
                while ($row = $stmt->fetchObject(get_class(new Sugestoes()))) {
                    $lista[$i] = $row;
                    $i++;
                }
                return $lista;
            } else {
                return array();
            }
        } catch (PDOException $ex) {
            die($ex->getMessage());
        }
    }

}

?>
