/** * Get all countries where dial code is not null * @param string $language language code * @return array */ public function getAllCountries($language = null) { if (!isset($language)) { $language = 'en'; } $query = " SELECT c.*,ct.value AS country_tr\n FROM country AS c\n LEFT JOIN country_translate AS ct ON c.code2 = ct.code2 AND ct.language = '" . addslashes($language) . "'\n WHERE c.dial_code is not NULL ORDER BY ct.value ASC"; $resultSet = $this->_dbTable->getAdapter()->fetchAll($query); $countries = array(); foreach ($resultSet as $row) { $country = new Application_Model_Country(); if ($row['country_tr']) { $row['name'] = $row['country_tr']; } $country->setOptions($row); $countries[] = $country; } return $countries; }