本文整理汇总了PHP中CRM_Core_DAO::executeUnbufferedQuery方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_DAO::executeUnbufferedQuery方法的具体用法?PHP CRM_Core_DAO::executeUnbufferedQuery怎么用?PHP CRM_Core_DAO::executeUnbufferedQuery使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Core_DAO
的用法示例。
在下文中一共展示了CRM_Core_DAO::executeUnbufferedQuery方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: exportComponents
//.........这里部分代码省略.........
}
$multipleSelectFields = array('preferred_communication_method' => 1);
$addPaymentHeader = FALSE;
$paymentDetails = array();
if ($paymentFields || $selectedPaymentFields) {
// get payment related in for event and members
$paymentDetails = CRM_Contribute_BAO_Contribution::getContributionDetails($exportMode, $ids);
//get all payment headers.
// If we haven't selected specific payment fields, load in all the
// payment headers.
if (!$selectedPaymentFields) {
$paymentHeaders = self::componentPaymentFields();
if (!empty($paymentDetails)) {
$addPaymentHeader = TRUE;
}
} else {
$paymentHeaders = array();
}
$nullContributionDetails = array_fill_keys(array_keys($paymentHeaders), NULL);
}
$componentDetails = array();
$setHeader = TRUE;
$rowCount = self::EXPORT_ROW_COUNT;
$offset = 0;
// we write to temp table often to avoid using too much memory
$tempRowCount = 100;
$count = -1;
// for CRM-3157 purposes
$i18n = CRM_Core_I18n::singleton();
list($outputColumns, $headerRows, $sqlColumns, $metadata) = self::getExportStructureArrays($returnProperties, $query, $phoneTypes, $imProviders, $contactRelationshipTypes, $relationQuery, $selectedPaymentFields);
$limitReached = FALSE;
while (!$limitReached) {
$limitQuery = "{$queryString} LIMIT {$offset}, {$rowCount}";
$dao = CRM_Core_DAO::executeUnbufferedQuery($limitQuery);
// If this is less than our limit by the end of the iteration we do not need to run the query again to
// check if some remain.
$rowsThisIteration = 0;
while ($dao->fetch()) {
$count++;
$rowsThisIteration++;
$row = array();
//convert the pseudo constants
// CRM-14398 there is problem in this architecture that is not easily solved. For now we are using the cloned
// temporary iterationDAO object to get around it.
// the issue is that the convertToPseudoNames function is adding additional properties (e.g for campaign) to the DAO object
// these additional properties are NOT reset when the $dao cycles through the while loop
// nor are they overwritten as they are not in the loop
// the convertToPseudoNames will not adequately over-write them either as it doesn't 'kick-in' unless the
// relevant property is set.
// It may be that a long-term fix could be introduced there - however, it's probably necessary to figure out how to test the
// export class before tackling a better architectural fix
$iterationDAO = clone $dao;
$query->convertToPseudoNames($iterationDAO);
//first loop through output columns so that we return what is required, and in same order.
$relationshipField = 0;
foreach ($outputColumns as $field => $value) {
// add im_provider to $dao object
if ($field == 'im_provider' && property_exists($iterationDAO, 'provider_id')) {
$iterationDAO->im_provider = $iterationDAO->provider_id;
}
//build row values (data)
$fieldValue = NULL;
if (property_exists($iterationDAO, $field)) {
$fieldValue = $iterationDAO->{$field};
// to get phone type from phone type id
if ($field == 'phone_type_id' && isset($phoneTypes[$fieldValue])) {