public static function getStops(Agency $agency, $version = 0) { /** * @var DB */ $dbObj = DBPool::getInstance(); $version = $version == 0 ? TableUpdate::getVersion() : $version; $dbObj->bindParams(array($agency->getId(), TableUpdate::getVersion())); $stops = $dbObj->get_results("SELECT * FROM stop WHERE agency_id=?\n AND version = ?"); if ($dbObj->num_rows > 0) { $stopArray = array(); foreach ($stops as $s) { $stopObj = new Stop(); $stopObj->setId($s->id); $stopObj->setAgency($agency); $stopObj->setFlipStopTag($s->flip_stop_tag); $stopObj->setTag($s->tag); $stopObj->setTitle($s->title); $stopObj->setPrettyTitle($s->pretty_title); $stopObj->setLatitude($s->latitude); $stopObj->setLongitude($s->longitude); $stopArray[$s->tag] = $stopObj; } return $stopArray; } else { //TODO: Don't use a generic exception throw new Exception("No data available - Stop::getStops"); } }