本文整理汇总了PHP中Host::setData方法的典型用法代码示例。如果您正苦于以下问题:PHP Host::setData方法的具体用法?PHP Host::setData怎么用?PHP Host::setData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Host
的用法示例。
在下文中一共展示了Host::setData方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getAllHosts
/**
* Get all hosts
*@return array Set of Host objects
*/
public static function getAllHosts($cacheMinutes = null)
{
$hosts = array();
$sql = MySqlDbManager::getQueryObject();
$sql->exec("SELECT * FROM `" . Tbl::get('TBL_HOSTS', 'Host') . "`", $cacheMinutes);
while (($host_data = $sql->fetchRecord()) != false) {
$h = new Host();
Host::setData($host_data, $h);
$hosts[] = $h;
}
return $hosts;
}
示例2: getLanguageHosts
public static function getLanguageHosts(Language $lang)
{
$hosts = array();
$sql = MySqlDbManager::getQueryObject();
$sql->exec("SELECT h.* FROM `" . Tbl::get('TBL_PAGE_INFO', 'PageInfo') . "` pi \n\t\t\t\t\tLEFT JOIN `" . Host::TBL_HOSTS . "` h ON h.id = pi.host_id \n\t\t\t\t\tWHERE pi.lang_id='{$lang->id}' AND pi.host_id IS NOT NULL\n\t\t\t\t\tGROUP BY h.id");
$hosts_data = $sql->fetchRecords();
foreach ($hosts_data as $host_data) {
$host = new Host();
Host::setData($host_data, $host);
$hosts[] = $host;
}
return $hosts;
}
示例3: getLanguageHosts
public static function getLanguageHosts(Language $lang, $cacheMinutes = null)
{
$hosts = array();
$sql = MySqlDbManager::getQueryObject();
$qb = new QueryBuilder();
$qb->select(new Field('*', 'h'))->from(Tbl::get('TBL_PAGE_INFO', 'PageInfo'), 'pi')->leftJoin(Tbl::get('TBL_HOSTS', 'Host'), 'h', $qb->expr()->equal(new Field('id', 'h'), new Field('host_id', 'pi')))->where($qb->expr()->equal(new Field('lang_id', 'pi'), $lang->id))->andWhere($qb->expr()->isNotNull(new Field('host_id', 'pi')))->groupBy(new Field('id', 'h'));
$sql->exec($qb->getSQL(), $cacheMinutes);
$hosts_data = $sql->fetchRecords();
foreach ($hosts_data as $host_data) {
$host = new Host();
Host::setData($host_data, $host);
$hosts[] = $host;
}
return $hosts;
}
示例4: getAllPairs
/**
* Get all possible pairs of Host Language
*
* @return array 2D array key is host_language_id with "host" and "language" keys with values as corresponding objects
*/
public static function getAllPairs($cacheMinutes = null)
{
$pairs = array();
$sql = MySqlDbManager::getQueryObject();
$sql->exec("SELECT *, hl.id host_lang_id FROM " . Tbl::get('TBL_HOST_LANGUAGE') . " hl\n\t\t\t\t\tLEFT JOIN `" . Tbl::get("TBL_LANGUAGES", "Language") . "` l ON hl.lang_id=l.id\n\t\t\t\t\tLEFT JOIN `" . Tbl::get("TBL_HOSTS", "Host") . "` h ON hl.host_id=h.id", $cacheMinutes);
while (($row = $sql->fetchRecord()) != false) {
$host = new Host();
$language = new Language();
$row["id"] = $row["lang_id"];
Language::setData($row, $language);
$row["id"] = $row["host_id"];
Host::setData($row, $host);
$pairs[$row["host_lang_id"]] = array("host" => $host, "language" => $language);
}
return $pairs;
}
示例5: getAllHosts
/**
* Get all hosts
*@return array Set of Host objects
*/
public static function getAllHosts(MysqlPager $pager = null, $cacheMinutes = null)
{
$hosts = array();
$sql = MySqlDbManager::getQueryObject();
$qb = new QueryBuilder();
$qb->select(new Field('*'))->from(Tbl::get('TBL_HOSTS', 'Host'));
if ($pager !== null) {
$sql = $pager->executePagedSQL($qb->getSQL(), $cacheMinutes);
} else {
$sql->exec($qb->getSQL(), $cacheMinutes);
}
while (($host_data = $sql->fetchRecord()) != false) {
$h = new Host();
Host::setData($host_data, $h);
$hosts[] = $h;
}
return $hosts;
}
示例6: getAllPairs
/**
* Get all possible pairs of Host Language
*
* @return array 2D array key is host_language_id with "host" and "language" keys with values as corresponding objects
*/
public static function getAllPairs($cacheMinutes = null)
{
$pairs = array();
$sql = MySqlDbManager::getQueryObject();
$qb = new QueryBuilder();
$qb->select(array(new Field('*'), new Field('id', 'hl', 'host_lang_id')))->from(Tbl::get('TBL_HOST_LANGUAGE'), 'hl')->leftJoin(Tbl::get("TBL_LANGUAGES", "Language"), 'l', $qb->expr()->equal(new Field('lang_id', 'hl'), new Field('id', 'l')))->leftJoin(Tbl::get("TBL_HOSTS", "Host"), 'h', $qb->expr()->equal(new Field('host_id', 'hl'), new Field('id', 'h')));
$sql->exec($qb->getSQL(), $cacheMinutes);
while (($row = $sql->fetchRecord()) != false) {
$host = new Host();
$language = new Language();
$row["id"] = $row["lang_id"];
Language::setData($row, $language);
$row["id"] = $row["host_id"];
Host::setData($row, $host);
$pairs[$row["host_lang_id"]] = array("host" => $host, "language" => $language);
}
return $pairs;
}