public static function getAgencies() { $dbObj = DBPool::getInstance(); $agencies = $dbObj->get_results("SELECT * FROM agency"); if ($dbObj->num_rows > 0) { $agencyArray = array(); foreach ($agencies as $a) { $agencyObj = new Agency(); $agencyObj->setId($a->id); $agencyObj->setTitle($a->title); $agencyObj->setShortTitle($a->short_title); $agencyObj->setDefaultVehicleType($a->default_vehicle); $agencyArray[$a->short_title] = $agencyObj; } return $agencyArray; } else { throw new Exception("There are no agencies in the database"); } }