当前位置: 首页>>代码示例>>PHP>>正文


PHP CRM_Core_DAO::_dbColumnValueCache方法代码示例

本文整理汇总了PHP中CRM_Core_DAO::_dbColumnValueCache方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_DAO::_dbColumnValueCache方法的具体用法?PHP CRM_Core_DAO::_dbColumnValueCache怎么用?PHP CRM_Core_DAO::_dbColumnValueCache使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CRM_Core_DAO的用法示例。


在下文中一共展示了CRM_Core_DAO::_dbColumnValueCache方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: fopen

<?php

//initialize civicrm
$rootPath = '/var/www/drupal7/sites/all/modules/civicrm/';
require_once $rootPath . 'civicrm.config.php';
require_once $rootPath . 'CRM/Core/Config.php';
$config = CRM_Core_Config::singleton();
CRM_Core_DAO::$_dbColumnValueCache = NULL;
//readfile
$fileName = 'MyImport2.csv';
CRM_Core_Error::debug('$fileName', $fileName);
exit;
//$fileName = 'test1.csv';
$read = fopen($fileName, 'r');
$rows = fgetcsv($read);
$contactSubType = array('Associate Supplier' => 'Associate', 'Foodservice Operator' => 'Food_Service_Operator');
$stateProvince = CRM_Core_PseudoConstant::stateProvinceForCountry(1039, 'abbreviation');
$errors['org'] = $errors['ind'] = $errors['mem'] = array();
$totalImported = 0;
while ($rows = fgetcsv($read)) {
    CRM_Core_Error::debug('$rows', $rows[0] . '/n \\n');
    $contactResult = civicrm_api3('Contact', 'get', array('return' => 'id', 'external_identifier' => $rows[0]));
    $membershipResult = array();
    if (empty($contactResult['id'])) {
        $contactParams = array('external_identifier' => $rows[0], 'contact_type' => 'Organization', 'sort_name' => $rows[3], 'contact_sub_type' => $contactSubType[$rows[2]], 'display_name' => $rows[3], 'source' => 'Import via script', 'organization_name' => $rows[5], 'email' => $rows[19], 'api.Address.create' => array('location_type_id' => 3, 'is_primary' => 1, 'street_address' => $rows[7], 'city' => $rows[13], 'state_province_id' => array_search($rows[14], $stateProvince), 'postal_code' => $rows[15], 'country_id' => 1039), 'api.Phone.create' => array(array('location_type_id' => 3, 'is_primary' => 1, 'phone' => $rows[11], 'phone_type_id' => 1), array('location_type_id' => 3, 'is_primary' => 1, 'phone' => $rows[12], 'phone_type_id' => 3)));
        $contactResult = civicrm_api3('Contact', 'create', $contactParams);
    } else {
        $errors['org'][] = $rows[0];
        // check for membership for CFRA ID
        $membershipResult = civicrm_api3('Membership', 'get', array('contact_id' => $contactResult['id'], 'return' => 'id'));
    }
开发者ID:JMAConsulting,项目名称:restaurantscanada,代码行数:31,代码来源:rcContacts.php

示例2: flushCache

 /**
  * Reset the various system caches and some important static variables.
  */
 public static function flushCache()
 {
     // flush out all cache entries so we can reload new data
     // a bit aggressive, but livable for now
     $cache = CRM_Utils_Cache::singleton();
     $cache->flush();
     // also reset the various static memory caches
     // reset the memory or array cache
     CRM_Core_BAO_Cache::deleteGroup('contact fields', NULL, FALSE);
     // reset ACL cache
     CRM_ACL_BAO_Cache::resetCache();
     // reset various static arrays used here
     CRM_Contact_BAO_Contact::$_importableFields = CRM_Contact_BAO_Contact::$_exportableFields = CRM_Contribute_BAO_Contribution::$_importableFields = CRM_Contribute_BAO_Contribution::$_exportableFields = CRM_Pledge_BAO_Pledge::$_exportableFields = CRM_Contribute_BAO_Query::$_contributionFields = CRM_Core_BAO_CustomField::$_importFields = CRM_Core_BAO_Cache::$_cache = CRM_Core_DAO::$_dbColumnValueCache = NULL;
     CRM_Core_OptionGroup::flushAll();
     CRM_Utils_PseudoConstant::flushAll();
 }
开发者ID:rollox,项目名称:civicrm-core,代码行数:19,代码来源:System.php

示例3: getFieldValue

 /**
  * Given a DAO name, a column name and a column value, find the record and GET the value of another column in that record
  *
  * @param string $daoName
  *   Name of the DAO (Example: CRM_Contact_DAO_Contact to retrieve value from a contact).
  * @param int $searchValue
  *   Value of the column you want to search by.
  * @param string $returnColumn
  *   Name of the column you want to GET the value of.
  * @param string $searchColumn
  *   Name of the column you want to search by.
  * @param bool $force
  *   Skip use of the cache.
  *
  * @return string|null
  *   Value of $returnColumn in the retrieved record
  */
 public static function getFieldValue($daoName, $searchValue, $returnColumn = 'name', $searchColumn = 'id', $force = FALSE)
 {
     if (empty($searchValue) || trim(strtolower($searchValue)) == 'null') {
         // adding this year since developers forget to check for an id
         // or for the 'null' (which is a bad DAO kludge)
         // and hence we get the first value in the db
         CRM_Core_Error::fatal();
     }
     $cacheKey = "{$daoName}:{$searchValue}:{$returnColumn}:{$searchColumn}";
     if (self::$_dbColumnValueCache === NULL) {
         self::$_dbColumnValueCache = array();
     }
     if (!array_key_exists($cacheKey, self::$_dbColumnValueCache) || $force) {
         $object = new $daoName();
         $object->{$searchColumn} = $searchValue;
         $object->selectAdd();
         $object->selectAdd($returnColumn);
         $result = NULL;
         if ($object->find(TRUE)) {
             $result = $object->{$returnColumn};
         }
         $object->free();
         self::$_dbColumnValueCache[$cacheKey] = $result;
     }
     return self::$_dbColumnValueCache[$cacheKey];
 }
开发者ID:konadave,项目名称:civicrm-core,代码行数:43,代码来源:DAO.php


注:本文中的CRM_Core_DAO::_dbColumnValueCache方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。