本文整理匯總了PHP中CRM_Contact_BAO_Query::includePseudoFieldsJoin方法的典型用法代碼示例。如果您正苦於以下問題:PHP CRM_Contact_BAO_Query::includePseudoFieldsJoin方法的具體用法?PHP CRM_Contact_BAO_Query::includePseudoFieldsJoin怎麽用?PHP CRM_Contact_BAO_Query::includePseudoFieldsJoin使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類CRM_Contact_BAO_Query
的用法示例。
在下文中一共展示了CRM_Contact_BAO_Query::includePseudoFieldsJoin方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: apiQuery
/**
* These are stub comments as this function needs more explanation - particularly in terms of how it
* relates to $this->searchQuery and why it replicates rather than calles $this->searchQuery.
*
* This function was originally written as a wrapper for the api query but is called from multiple places
* in the core code directly so the name is misleading. This function does not use the searchQuery function
* but it is unclear as to whehter that is historical or there is a reason
* CRM-11290 led to the permissioning action being extracted from searchQuery & shared with this function
*
* @param array $params
* @param array $returnProperties
* @param null $fields
* @param string $sort
* @param int $offset
* @param int $row_count
* @param bool $smartGroupCache
* ?? update smart group cache?.
* @param bool $count
* Return count obnly.
* @param bool $skipPermissions
* Should permissions be ignored or should the logged in user's permissions be applied.
*
*
* @return array
*/
public static function apiQuery($params = NULL, $returnProperties = NULL, $fields = NULL, $sort = NULL, $offset = 0, $row_count = 25, $smartGroupCache = TRUE, $count = FALSE, $skipPermissions = TRUE)
{
$query = new CRM_Contact_BAO_Query($params, $returnProperties, NULL, TRUE, FALSE, 1, $skipPermissions, TRUE, $smartGroupCache);
//this should add a check for view deleted if permissions are enabled
if ($skipPermissions) {
$query->_skipDeleteClause = TRUE;
}
$query->generatePermissionClause(FALSE, $count);
// note : this modifies _fromClause and _simpleFromClause
$query->includePseudoFieldsJoin($sort);
list($select, $from, $where, $having) = $query->query($count);
$options = $query->_options;
if (!empty($query->_permissionWhereClause)) {
if (empty($where)) {
$where = "WHERE {$query->_permissionWhereClause}";
} else {
$where = "{$where} AND {$query->_permissionWhereClause}";
}
}
$sql = "{$select} {$from} {$where} {$having}";
// add group by
if ($query->_useGroupBy) {
$sql .= ' GROUP BY contact_a.id';
}
if (!empty($sort)) {
$sort = CRM_Utils_Type::escape($sort, 'String');
$sql .= " ORDER BY {$sort} ";
}
if ($row_count > 0 && $offset >= 0) {
$offset = CRM_Utils_Type::escape($offset, 'Int');
$rowCount = CRM_Utils_Type::escape($row_count, 'Int');
$sql .= " LIMIT {$offset}, {$row_count} ";
}
$dao = CRM_Core_DAO::executeQuery($sql);
$values = array();
while ($dao->fetch()) {
if ($count) {
$noRows = $dao->rowCount;
$dao->free();
return array($noRows, NULL);
}
$val = $query->store($dao);
$convertedVals = $query->convertToPseudoNames($dao, TRUE);
if (!empty($convertedVals)) {
$val = array_replace_recursive($val, $convertedVals);
}
$values[$dao->contact_id] = $val;
}
$dao->free();
return array($values, $options);
}