当前位置: 首页>>代码示例>>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;未经允许,请勿转载。