本文整理汇总了PHP中Institution::setName方法的典型用法代码示例。如果您正苦于以下问题:PHP Institution::setName方法的具体用法?PHP Institution::setName怎么用?PHP Institution::setName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Institution
的用法示例。
在下文中一共展示了Institution::setName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: institutions
private function institutions($data)
{
$q = $this->getRequestParameter("q", '');
if (!$q) {
throw new BadRequestException('A search string must be provided.');
}
$page = $this->getRequestParameter("page", '1');
$limit = $this->getRequestParameter("limit", self::PAGE_SIZE);
$culture = $this->getRequestParameter("culture", 'es');
$type = $this->getRequestParameter("type", false);
$this->getUser()->setCulture($culture);
$cl = new SphinxClient();
$dbConf = Propel::getConfiguration();
$dsn = $dbConf['datasources']['propel']['connection']['dsn'];
$sphinxServer = sfConfig::get('sf_sphinx_server');
$cl->SetServer($sphinxServer, 3312);
$this->limit = 1000;
$cl->SetLimits(0, $this->limit, $this->limit);
$cl->SetArrayResult(true);
#instituciones
$this->res = $cl->Query($q, "institucion_{$culture}");
$cl->SetFieldWeights(array('vanity' => 5));
$cl->SetSortMode(SPH_SORT_RELEVANCE);
$institutions = array();
if ($this->res !== false) {
if (isset($this->res["matches"]) && is_array($this->res["matches"])) {
$c = new Criteria();
$list = array();
foreach ($this->res["matches"] as $idx => $match) {
$list[] = $match['id'];
}
$c->add(InstitucionPeer::ID, $list, Criteria::IN);
$c->addAscendingOrderByColumn(InstitucionPeer::ORDEN);
//$instituciones = InstitucionPeer::doSelect($c);
$pager = new sfPropelPager('Institucion', $limit);
$pager->setCriteria($c);
$pager->setPage($this->getRequestParameter('page', $page));
$pager->init();
foreach ($pager->getResults() as $aInstitution) {
$institution = new Institution();
$institution->setId($aInstitution->getId());
$institution->setVanity($aInstitution->getVanity());
$institution->setName($aInstitution->getNombreCorto());
$institution->setLongName($aInstitution->getNombre());
$institutions[] = $institution;
}
}
}
return $institutions;
}