connection = new MySql(); } /** Listagem de todos os registros */ public function all() { /** Montagem do SQL */ $this->sql = 'SELECT * FROM states ORDER BY name ASC'; /** Preparo o SQL para execução */ $this->stmt = $this->connection->connect()->prepare($this->sql); /** Executo o SQL */ $this->stmt->execute(); /** Retorno o resultado */ return $this->stmt->fetchAll(\PDO::FETCH_OBJ); } /** Destrutor da classe */ public function __destruct() { /** Instanciamento da classe */ $this->connection = null; } }