當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Gpf_SqlBuilder_SelectBuilder::getAllRowsIndexedBy方法代碼示例

本文整理匯總了PHP中Gpf_SqlBuilder_SelectBuilder::getAllRowsIndexedBy方法的典型用法代碼示例。如果您正苦於以下問題:PHP Gpf_SqlBuilder_SelectBuilder::getAllRowsIndexedBy方法的具體用法?PHP Gpf_SqlBuilder_SelectBuilder::getAllRowsIndexedBy怎麽用?PHP Gpf_SqlBuilder_SelectBuilder::getAllRowsIndexedBy使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Gpf_SqlBuilder_SelectBuilder的用法示例。


在下文中一共展示了Gpf_SqlBuilder_SelectBuilder::getAllRowsIndexedBy方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: loadFullStatistics

	/**
	 *
	 * @service banner_stats read
	 * @param $data
	 */
	public function loadFullStatistics(Gpf_Rpc_Params $params) {
		$data = new Gpf_Rpc_Data($params);

		$select = new Gpf_SqlBuilder_SelectBuilder();
		$select->from->add(Pap_Db_Table_Banners::getName());
		$select->select->add("COUNT(".Pap_Db_Table_Banners::ID.")", "count");
		$select->select->add(Pap_Db_Table_Banners::TYPE, 'type');
		$select->groupBy->add(Pap_Db_Table_Banners::TYPE);
		
		Gpf_Plugins_Engine::extensionPoint('AffiliateNetwork.modifyWhere', 
        new Gpf_Common_SelectBuilderCompoundRecord($select, new Gpf_Data_Record(array(), array())));
		
        $result = $select->getAllRowsIndexedBy('type');
		$bannerTypes = explode(',', $data->getParam('bannerTypes'));		
		
		$bannersCount = 0;
		foreach ($bannerTypes as $bannerType) {
			$bannerTypeCount = 0;
			try {
				$bannerTypeCount = $result->getRecord($bannerType)->get('count');
			} catch (Gpf_Data_RecordSetNoRowException $e) {				
			}
			$data->setValue($bannerType, "$bannerTypeCount");
			$bannersCount += $bannerTypeCount;
		}
		$data->setValue("bannersCount", "$bannersCount");		

		return $data;
	}
開發者ID:AmineCherrai,項目名稱:rostanvo,代碼行數:34,代碼來源:BannersInfoData.class.php

示例2: loadAttributes

 public function loadAttributes($userId)
 {
     $select = new Gpf_SqlBuilder_SelectBuilder();
     $select->select->add(self::NAME);
     $select->select->add(self::VALUE);
     $select->from->add(self::getName(), 'ua');
     $select->where->add(self::ACCOUNT_USER_ID, '=', $userId);
     $this->attributes = $select->getAllRowsIndexedBy('name');
 }
開發者ID:AmineCherrai,項目名稱:rostanvo,代碼行數:9,代碼來源:UserAttributes.class.php

示例3: getActiveLanguagesNoRpc

 /**
  * Get recordset of active languages in this account
  *
  * @return Gpf_Data_IndexedRecordSet
  */
 public function getActiveLanguagesNoRpc()
 {
     $sql = new Gpf_SqlBuilder_SelectBuilder();
     $sql->select->add(Gpf_Db_Table_Languages::CODE);
     $sql->select->add(Gpf_Db_Table_Languages::ENGLISH_NAME);
     $sql->select->add(Gpf_Db_Table_Languages::NAME);
     $sql->select->add(Gpf_Db_Table_Languages::IS_DEFAULT);
     $sql->from->add(Gpf_Db_Table_Languages::getName());
     $sql->where->add(Gpf_Db_Table_Accounts::ID, '=', Gpf_Application::getInstance()->getAccountId());
     $sql->where->add(Gpf_Db_Table_Languages::ACTIVE, '=', Gpf::YES);
     $sql->orderBy->add(Gpf_Db_Table_Languages::NAME);
     return $sql->getAllRowsIndexedBy(Gpf_Db_Table_Languages::CODE);
 }
開發者ID:AmineCherrai,項目名稱:rostanvo,代碼行數:18,代碼來源:Languages.class.php


注:本文中的Gpf_SqlBuilder_SelectBuilder::getAllRowsIndexedBy方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。