From 12ee147bc767296b25e474b06b56c208e6106a5f Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Thu, 31 Dec 2015 10:13:48 -0500 Subject: [PATCH] Add a find_all function to return an array of Server objects --- web/includes/Server.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/web/includes/Server.php b/web/includes/Server.php index 79dbb7ddb..d254227ca 100644 --- a/web/includes/Server.php +++ b/web/includes/Server.php @@ -1,6 +1,7 @@ {'Hostname'} = ''; } } + public static function find_all() { + $servers = array(); + $result = dbQuery( 'SELECT * FROM Servers ORDER BY Name'); + $results = $result->fetchALL(PDO::FETCH_CLASS | PDO::FETCH_PROPS_LATE, 'Server' ); + foreach ( $results as $row => $server_obj ) { + $servers[] = $server_obj; + } + return $servers; + } public function Url() { return ZM_BASE_PROTOCOL . '://'. $this->Hostname();