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


PHP FindParams::join方法代碼示例

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


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

示例1: beforeStoreStatement

 protected function beforeStoreStatement(array &$response, array &$params, \GO\Base\Data\AbstractStore &$store, \GO\Base\Db\FindParams $storeParams)
 {
     //SELECT * FROM cal_categories t
     //LEFT JOIN go_acl ON (`t`.`acl_id` = go_acl.acl_id AND (go_acl.user_id=57 OR go_acl.group_id IN (2)))
     //WHERE t.calendar_id = 0 AND go_acl.acl_id IS NOT NULL OR t.calendar_id=56
     $groupIds = \GO\Base\Model\User::getGroupIds(\GO::user()->id);
     $storeCriteria = $storeParams->getCriteria();
     $joinUserGroupCriteria = \GO\Base\Db\FindCriteria::newInstance()->addCondition('user_id', \GO::user()->id, '=', 'go_acl', false)->addInCondition('group_id', $groupIds, 'go_acl', false);
     $joinCriteria = \GO\Base\Db\FindCriteria::newInstance()->addCondition('acl_id', 'go_acl.acl_id', '=', 't', true, true)->mergeWith($joinUserGroupCriteria);
     $storeParams->join('go_acl', $joinCriteria, 'go_acl', 'LEFT');
     if (!empty($params['global_categories']) && !empty($params['calendar_id'])) {
         $storeCriteria->addCondition('calendar_id', 0, '=', 't', false);
         $storeCriteria->addCondition('acl_id', NULL, 'IS NOT', 'go_acl');
         $storeCriteria->addCondition('calendar_id', $params['calendar_id'], '=', 't', false);
     } elseif (!empty($params['calendar_id'])) {
         $storeCriteria->addCondition('calendar_id', $params['calendar_id']);
     } else {
         $storeCriteria->addCondition('calendar_id', 0);
     }
     $storeParams->ignoreAcl();
     return parent::beforeStoreStatement($response, $params, $store, $storeParams);
 }
開發者ID:ajaboa,項目名稱:crmpuan,代碼行數:22,代碼來源:CategoryController.php

示例2: beforeHandleAdvancedQuery

 protected function beforeHandleAdvancedQuery($advQueryRecord, \GO\Base\Db\FindCriteria &$criteriaGroup, \GO\Base\Db\FindParams &$storeParams)
 {
     $storeParams->debugSql();
     switch ($advQueryRecord['field']) {
         case 'employees.name':
             $storeParams->join(\GO\Addressbook\Model\Contact::model()->tableName(), \GO\Base\Db\FindCriteria::newInstance()->addRawCondition('`t`.`id`', '`employees' . $advQueryRecord['id'] . '`.`company_id`'), 'employees' . $advQueryRecord['id']);
             $criteriaGroup->addRawCondition('CONCAT_WS(\' \',`employees' . $advQueryRecord['id'] . '`.`first_name`,`employees' . $advQueryRecord['id'] . '`.`middle_name`,`employees' . $advQueryRecord['id'] . '`.`last_name`)', ':employee' . $advQueryRecord['id'], $advQueryRecord['comparator'], $advQueryRecord['andor'] == 'AND');
             $criteriaGroup->addBindParameter(':employee' . $advQueryRecord['id'], $advQueryRecord['value']);
             return false;
             break;
         default:
             return true;
             break;
     }
 }
開發者ID:ajaboa,項目名稱:crmpuan,代碼行數:15,代碼來源:CompanyController.php


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