本文整理汇总了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);
}
示例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;
}
}