/** * This will return one country only. It is intended for sites with one country only. **/ public function loadBySite(SiteModel $site) { global $DB; $stat = $DB->prepare("SELECT country.* FROM country " . " JOIN country_in_site_information ON country_in_site_information.country_id = country.id AND country_in_site_information.is_in = '1' " . " WHERE country_in_site_information.site_id=:id "); $stat->execute(array('id' => $site->getId())); if ($stat->rowCount() > 0) { $country = new CountryModel(); $country->setFromDataBaseRow($stat->fetch()); return $country; } }
public function fetchAll() { $this->buildStart(); $this->build(); $this->buildStat(); $results = array(); while ($data = $this->stat->fetch()) { $country = new CountryModel(); $country->setFromDataBaseRow($data); $results[] = $country; } return $results; }