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


PHP CRM_Utils_Array::multiArrayDiff方法代码示例

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


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

示例1: getItem

 /**
  * Retrieve the value of a setting from the DB table.
  *
  * @param string $group
  *   (required) The group name of the item.
  * @param string $name
  *   (required) The name under which this item is stored.
  * @param int $componentID
  *   The optional component ID (so componenets can share the same name space).
  * @param string $defaultValue
  *   The default value to return for this setting if not present in DB.
  * @param int $contactID
  *   If set, this is a contactID specific setting, else its a global setting.
  *
  * @param int $domainID
  *
  * @return mixed
  *   The data if present in the setting table, else null
  */
 public static function getItem($group, $name = NULL, $componentID = NULL, $defaultValue = NULL, $contactID = NULL, $domainID = NULL)
 {
     $overrideGroup = array();
     if (NULL !== ($override = self::getOverride($group, $name, NULL))) {
         if (isset($name)) {
             return $override;
         } else {
             $overrideGroup = $override;
         }
     }
     if (empty($domainID)) {
         $domainID = CRM_Core_Config::domainID();
     }
     $cacheKey = self::inCache($group, $name, $componentID, $contactID, TRUE, $domainID);
     if ($group && !isset($name) && $cacheKey) {
         // check value against the cache, and unset key if values are different
         $valueDifference = CRM_Utils_Array::multiArrayDiff($overrideGroup, self::$_cache[$cacheKey]);
         if (!empty($valueDifference)) {
             $cacheKey = '';
         }
     }
     if (!$cacheKey) {
         $dao = self::dao($group, NULL, $componentID, $contactID, $domainID);
         $dao->find();
         $values = array();
         while ($dao->fetch()) {
             if (NULL !== ($override = self::getOverride($group, $dao->name, NULL))) {
                 $values[$dao->name] = $override;
             } elseif ($dao->value) {
                 $values[$dao->name] = unserialize($dao->value);
             } else {
                 $values[$dao->name] = NULL;
             }
         }
         $dao->free();
         if (!isset($name)) {
             // merge db and override group values
             // When no $name is present, the getItem() function should return an array
             // consisting of the sum of all override settings + all settings present in
             // the database for the given $group (with the overrides taking precedence,
             // and applying even if the setting is not defined in the database).
             //
             $values = array_merge($values, $overrideGroup);
         }
         $cacheKey = self::setCache($values, $group, $componentID, $contactID, $domainID);
     }
     return $name ? CRM_Utils_Array::value($name, self::$_cache[$cacheKey], $defaultValue) : self::$_cache[$cacheKey];
 }
开发者ID:kidaa30,项目名称:yes,代码行数:67,代码来源:Setting.php


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