當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CRM_Core_DAO_AllCoreTables類代碼示例

本文整理匯總了PHP中CRM_Core_DAO_AllCoreTables的典型用法代碼示例。如果您正苦於以下問題:PHP CRM_Core_DAO_AllCoreTables類的具體用法?PHP CRM_Core_DAO_AllCoreTables怎麽用?PHP CRM_Core_DAO_AllCoreTables使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了CRM_Core_DAO_AllCoreTables類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getEntityName

 /**
  * Attempts to retrieve the API entity name from any calling class.
  *
  * @param string|object $classNameOrObject
  *
  * @return string
  * @throws CRM_Core_Exception
  */
 static function getEntityName($classNameOrObject)
 {
     require_once 'api/api.php';
     $className = is_string($classNameOrObject) ? $classNameOrObject : get_class($classNameOrObject);
     // First try the obvious replacements
     $daoName = str_replace(array('_BAO_', '_Form_', '_Page_'), '_DAO_', $className);
     $shortName = CRM_Core_DAO_AllCoreTables::getBriefName($daoName);
     // If that didn't work, try a different pattern
     if (!$shortName) {
         list(, $parent, , $child) = explode('_', $className);
         $daoName = "CRM_{$parent}_DAO_{$child}";
         $shortName = CRM_Core_DAO_AllCoreTables::getBriefName($daoName);
     }
     // If that didn't work, try a different pattern
     if (!$shortName) {
         $daoName = "CRM_{$parent}_DAO_{$parent}";
         $shortName = CRM_Core_DAO_AllCoreTables::getBriefName($daoName);
     }
     // If that didn't work, try a different pattern
     if (!$shortName) {
         $daoName = "CRM_Core_DAO_{$child}";
         $shortName = CRM_Core_DAO_AllCoreTables::getBriefName($daoName);
     }
     if (!$shortName) {
         throw new CRM_Core_Exception('Could not find api name for supplied class');
     }
     return _civicrm_api_get_entity_name_from_camel($shortName);
 }
開發者ID:prashantgajare,項目名稱:civicrm-core,代碼行數:36,代碼來源:Api.php

示例2: getAllDAO

 /**
  * Get all DAO classes.
  */
 public function getAllDAO()
 {
     $classList = CRM_Core_DAO_AllCoreTables::getClasses();
     $return = array();
     foreach ($classList as $class) {
         $return[] = array($class);
     }
     return $return;
 }
開發者ID:GuGuss,項目名稱:civicrm-core,代碼行數:12,代碼來源:DAOConformanceTest.php

示例3: getAllDAO

 /**
  * Get all DAO classes.
  */
 public function getAllDAO()
 {
     $this->setUp();
     // Ugh. Need full bootstrap to enumerate classes.
     $classList = CRM_Core_DAO_AllCoreTables::getClasses();
     $return = array();
     foreach ($classList as $class) {
         $return[] = array($class);
     }
     return $return;
 }
開發者ID:nielosz,項目名稱:civicrm-core,代碼行數:14,代碼來源:DAOConformanceTest.php

示例4: findReferences

    /**
     * Create a query to find references to a particular record
     *
     * @param CRM_Core_DAO $targetDao the instance for which we want references
     * @return CRM_Core_DAO a query-handle (like the result of CRM_Core_DAO::executeQuery)
     */
    public function findReferences($targetDao)
    {
        $refColumn = $this->getReferenceKey();
        $targetColumn = $this->getTargetKey();
        $params = array(1 => array($targetDao->{$targetColumn}, 'String'), 2 => array($targetDao::getTableName(), 'String'));
        $sql = <<<EOS
SELECT id
FROM {$this->getReferenceTable()}
WHERE {$refColumn} = %1
AND {$this->getTypeColumn()} = %2
EOS;
        $daoName = CRM_Core_DAO_AllCoreTables::getClassForTable($this->getReferenceTable());
        $result = CRM_Core_DAO::executeQuery($sql, $params, TRUE, $daoName);
        return $result;
    }
開發者ID:prashantgajare,項目名稱:civicrm-core,代碼行數:21,代碼來源:Dynamic.php

示例5: getEntityName

 /**
  * Attempts to retrieve the API entity name from any calling class.
  * FIXME: This is a bit hackish but the naming convention for forms is not very strict
  *
  * @param string|object $classNameOrObject
  *
  * @return string
  * @throws CRM_Core_Exception
  */
 public static function getEntityName($classNameOrObject)
 {
     require_once 'api/api.php';
     $className = is_string($classNameOrObject) ? $classNameOrObject : get_class($classNameOrObject);
     // First try the obvious replacements
     $daoName = str_replace(array('_BAO_', '_Form_', '_Page_'), '_DAO_', $className);
     $entityName = CRM_Core_DAO_AllCoreTables::getBriefName($daoName);
     // If that didn't work, try a different pattern
     if (!$entityName) {
         list(, $parent, , $child) = explode('_', $className);
         $daoName = "CRM_{$parent}_DAO_{$child}";
         $entityName = CRM_Core_DAO_AllCoreTables::getBriefName($daoName);
     }
     // If that didn't work, try a different pattern
     if (!$entityName) {
         $daoName = "CRM_{$parent}_DAO_{$parent}";
         $entityName = CRM_Core_DAO_AllCoreTables::getBriefName($daoName);
     }
     // If that didn't work, try a different pattern
     if (!$entityName) {
         $daoName = "CRM_Core_DAO_{$child}";
         $entityName = CRM_Core_DAO_AllCoreTables::getBriefName($daoName);
     }
     // If that didn't work, try using just the trailing name
     if (!$entityName) {
         $entityName = CRM_Core_DAO_AllCoreTables::getFullName($child) ? $child : NULL;
     }
     // If that didn't work, try using just the leading name
     if (!$entityName) {
         $entityName = CRM_Core_DAO_AllCoreTables::getFullName($parent) ? $parent : NULL;
     }
     if (!$entityName) {
         throw new CRM_Core_Exception('Could not find api name for supplied class');
     }
     return $entityName;
 }
開發者ID:kidaa30,項目名稱:yes,代碼行數:45,代碼來源:Api.php

示例6: array

 /**
  * Returns the list of fields that can be exported
  *
  * @param bool $prefix
  *
  * @return array
  */
 static function &export($prefix = false)
 {
     $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'participant_payment', $prefix, array());
     return $r;
 }
開發者ID:nielosz,項目名稱:civicrm-core,代碼行數:12,代碼來源:ParticipantPayment.php

示例7: _civicrm_api_get_entity_name_from_dao

/**
 * Having a DAO object find the entity name
 * @param object $bao DAO being passed in
 * @return string
 */
function _civicrm_api_get_entity_name_from_dao($bao)
{
    $daoName = str_replace("BAO", "DAO", get_class($bao));
    return _civicrm_api_get_entity_name_from_camel(CRM_Core_DAO_AllCoreTables::getBriefName($daoName));
}
開發者ID:prashantgajare,項目名稱:civicrm-core,代碼行數:10,代碼來源:api.php

示例8: civicrm_api3_generic_getrefcount

/**
 * API to determine if a record is in-use.
 *
 * @param array $apiRequest
 *   Api request as an array.
 *
 * @throws API_Exception
 * @return array
 *   API result (int 0 or 1)
 */
function civicrm_api3_generic_getrefcount($apiRequest)
{
    $entityToClassMap = CRM_Core_DAO_AllCoreTables::daoToClass();
    if (!isset($entityToClassMap[$apiRequest['entity']])) {
        throw new API_Exception("The entity '{$apiRequest['entity']}' is unknown or unsupported by 'getrefcount'. Consider implementing this API.", 'getrefcount_unsupported');
    }
    $daoClass = $entityToClassMap[$apiRequest['entity']];
    /* @var $dao CRM_Core_DAO */
    $dao = new $daoClass();
    $dao->id = $apiRequest['params']['id'];
    if ($dao->find(TRUE)) {
        return civicrm_api3_create_success($dao->getReferenceCounts());
    } else {
        return civicrm_api3_create_success(array());
    }
}
開發者ID:nielosz,項目名稱:civicrm-core,代碼行數:26,代碼來源:Generic.php

示例9: tearDown

 protected function tearDown()
 {
     CRM_Utils_Hook::singleton()->reset();
     CRM_Core_DAO_AllCoreTables::init(1);
     parent::tearDown();
 }
開發者ID:nielosz,項目名稱:civicrm-core,代碼行數:6,代碼來源:AllCoreTablesTest.php

示例10: rebuildMenuAndCaches

 static function rebuildMenuAndCaches($triggerRebuild = FALSE, $sessionReset = FALSE)
 {
     $config = CRM_Core_Config::singleton();
     $config->clearModuleList();
     // also cleanup all caches
     $config->cleanupCaches($sessionReset || CRM_Utils_Request::retrieve('sessionReset', 'Boolean', CRM_Core_DAO::$_nullObject, FALSE, 0, 'GET'));
     CRM_Core_Menu::store();
     // also reset navigation
     CRM_Core_BAO_Navigation::resetNavigation();
     // also cleanup module permissions
     $config->cleanupPermissions();
     // also rebuild word replacement cache
     CRM_Core_BAO_WordReplacement::rebuild();
     CRM_Core_BAO_Setting::updateSettingsFromMetaData();
     CRM_Core_Resources::singleton()->resetCacheCode();
     // also rebuild triggers if requested explicitly
     if ($triggerRebuild || CRM_Utils_Request::retrieve('triggerRebuild', 'Boolean', CRM_Core_DAO::$_nullObject, FALSE, 0, 'GET')) {
         CRM_Core_DAO::triggerRebuild();
     }
     CRM_Core_DAO_AllCoreTables::reinitializeCache(TRUE);
     CRM_Core_ManagedEntities::singleton(TRUE)->reconcile();
 }
開發者ID:TheCraftyCanvas,項目名稱:aegir-platforms,代碼行數:22,代碼來源:Invoke.php

示例11: getReferencesToTable

 /**
  * List all tables which have hard foreign keys to this table.
  *
  * For now, this returns a description of every entity_id/entity_table
  * reference.
  * TODO: filter dynamic entity references on the $tableName, based on
  * schema metadata in dynamicForeignKey which enumerates a restricted
  * set of possible entity_table's.
  *
  * @param string $tableName table referred to
  *
  * @return array structure of table and column, listing every table with a
  * foreign key reference to $tableName, and the column where the key appears.
  */
 static function getReferencesToTable($tableName)
 {
     $refsFound = array();
     foreach (CRM_Core_DAO_AllCoreTables::getClasses() as $daoClassName) {
         $links = $daoClassName::getReferenceColumns();
         $daoTableName = $daoClassName::getTableName();
         foreach ($links as $refSpec) {
             if ($refSpec->getTargetTable() === $tableName or $refSpec->isGeneric()) {
                 $refsFound[] = $refSpec;
             }
         }
     }
     return $refsFound;
 }
開發者ID:archcidburnziso,項目名稱:civicrm-core,代碼行數:28,代碼來源:DAO.php

示例12: preProcess

 /**
  * @param $entityTable
  */
 public static function preProcess($entityTable)
 {
     self::$_entityId = (int) CRM_Utils_Request::retrieve('id', 'Positive');
     self::$_entityTable = $entityTable;
     if (self::$_entityId && $entityTable) {
         $checkParentExistsForThisId = CRM_Core_BAO_RecurringEntity::getParentFor(self::$_entityId, $entityTable);
         if ($checkParentExistsForThisId) {
             self::$_hasParent = TRUE;
             self::$_parentEntityId = $checkParentExistsForThisId;
             self::$_scheduleReminderDetails = CRM_Core_BAO_RecurringEntity::getReminderDetailsByEntityId($checkParentExistsForThisId, $entityTable);
         } else {
             self::$_parentEntityId = self::$_entityId;
             self::$_scheduleReminderDetails = CRM_Core_BAO_RecurringEntity::getReminderDetailsByEntityId(self::$_entityId, $entityTable);
         }
         if (property_exists(self::$_scheduleReminderDetails, 'id')) {
             self::$_scheduleReminderID = self::$_scheduleReminderDetails->id;
         }
     }
     CRM_Core_OptionValue::getValues(array('name' => $entityTable . '_repeat_exclude_dates_' . self::$_parentEntityId), $optionValue);
     $excludeOptionValues = array();
     if (!empty($optionValue)) {
         foreach ($optionValue as $key => $val) {
             $excludeOptionValues[$val['value']] = substr(CRM_Utils_Date::mysqlToIso($val['value']), 0, 10);
         }
         self::$_excludeDateInfo = $excludeOptionValues;
     }
     // Assign variables
     $entityType = CRM_Core_DAO_AllCoreTables::getBriefName(CRM_Core_DAO_AllCoreTables::getClassForTable($entityTable));
     $tpl = CRM_Core_Smarty::singleton();
     $tpl->assign('recurringEntityType', ts($entityType));
     $tpl->assign('currentEntityId', self::$_entityId);
     $tpl->assign('entityTable', self::$_entityTable);
     $tpl->assign('scheduleReminderId', self::$_scheduleReminderID);
     $tpl->assign('hasParent', self::$_hasParent);
 }
開發者ID:FundingWorks,項目名稱:civicrm-core,代碼行數:38,代碼來源:RecurringEntity.php

示例13: getReferencesToTable

 /**
  * List all tables which have hard foreign keys to this table.
  *
  * For now, this returns a description of every entity_id/entity_table
  * reference.
  * TODO: filter dynamic entity references on the $tableName, based on
  * schema metadata in dynamicForeignKey which enumerates a restricted
  * set of possible entity_table's.
  *
  * @param string $tableName
  *   Table referred to.
  *
  * @return array
  *   structure of table and column, listing every table with a
  *   foreign key reference to $tableName, and the column where the key appears.
  */
 public static function getReferencesToTable($tableName)
 {
     $refsFound = array();
     foreach (CRM_Core_DAO_AllCoreTables::getClasses() as $daoClassName) {
         $links = $daoClassName::getReferenceColumns();
         $daoTableName = $daoClassName::getTableName();
         foreach ($links as $refSpec) {
             /** @var $refSpec CRM_Core_Reference_Interface */
             if ($refSpec->matchesTargetTable($tableName)) {
                 $refsFound[] = $refSpec;
             }
         }
     }
     return $refsFound;
 }
開發者ID:konadave,項目名稱:civicrm-core,代碼行數:31,代碼來源:DAO.php

示例14: addFkField

 /**
  * Joins onto an fk field
  *
  * Adds one or more joins to the query to make this field available for use in a clause.
  *
  * Enforces permissions at the api level and by appending the acl clause for that entity to the join.
  *
  * @param $fkFieldName
  * @return array|null
  *   Returns the table and field name for adding this field to a SELECT or WHERE clause
  * @throws \API_Exception
  * @throws \Civi\API\Exception\UnauthorizedException
  */
 private function addFkField($fkFieldName)
 {
     $stack = explode('.', $fkFieldName);
     if (count($stack) < 2) {
         return NULL;
     }
     $prev = 'a';
     foreach ($stack as $depth => $fieldName) {
         // Setup variables then skip the first level
         if (!$depth) {
             $fk = $fieldName;
             // We only join on core fields
             // @TODO: Custom contact ref fields could be supported too
             if (!in_array($fk, $this->entityFieldNames)) {
                 return NULL;
             }
             $fkField =& $this->apiFieldSpec[$fk];
             continue;
         }
         // More than 4 joins deep seems excessive - DOS attack?
         if ($depth > self::MAX_JOINS) {
             throw new UnauthorizedException("Maximum number of joins exceeded for api.{$this->entity}.get in parameter {$fkFieldName}");
         }
         if (!isset($fkField['FKApiName']) && !isset($fkField['FKClassName'])) {
             // Join doesn't exist - might be another param with a dot in it for some reason, we'll just ignore it.
             return NULL;
         }
         // Ensure we have permission to access the other api
         if (!$this->checkPermissionToJoin($fkField['FKApiName'], array_slice($stack, 0, $depth))) {
             throw new UnauthorizedException("Authorization failed to join onto {$fkField['FKApiName']} api in parameter {$fkFieldName}");
         }
         if (!isset($fkField['FKApiSpec'])) {
             $fkField['FKApiSpec'] = \_civicrm_api_get_fields($fkField['FKApiName']);
         }
         $fieldInfo = \CRM_Utils_Array::value($fieldName, $fkField['FKApiSpec']);
         // FIXME: What if the foreign key is not the "id" column?
         if (!$fieldInfo || !isset($fkField['FKApiSpec']['id'])) {
             // Join doesn't exist - might be another param with a dot in it for some reason, we'll just ignore it.
             return NULL;
         }
         $fkTable = \CRM_Core_DAO_AllCoreTables::getTableForClass($fkField['FKClassName']);
         $tableAlias = implode('_to_', array_slice($stack, 0, $depth)) . "_to_{$fkTable}";
         $joinClause = "LEFT JOIN {$fkTable} {$tableAlias} ON {$prev}.{$fk} = {$tableAlias}.id";
         // Add acl condition
         $joinCondition = $this->getAclClause($tableAlias, $fkField['FKClassName']);
         if ($joinCondition !== NULL) {
             $joinClause .= " AND {$joinCondition}";
         }
         $this->query->join($tableAlias, $joinClause);
         if (strpos($fieldName, 'custom_') === 0) {
             list($tableAlias, $fieldName) = $this->addCustomField($fieldInfo, $tableAlias);
         }
         // Get ready to recurse to the next level
         $fk = $fieldName;
         $fkField =& $fkField['FKApiSpec'][$fieldName];
         $prev = $tableAlias;
     }
     return array($tableAlias, $fieldName);
 }
開發者ID:Prem-Patel,項目名稱:civicrm-core,代碼行數:72,代碼來源:SelectQuery.php

示例15: getOptionEditUrl

 /**
  * Lookup the admin page at which a field's option list can be edited
  * @param $fieldSpec
  * @return string|null
  */
 static function getOptionEditUrl($fieldSpec)
 {
     // If it's an option group, that's easy
     if (!empty($fieldSpec['pseudoconstant']['optionGroupName'])) {
         return 'civicrm/admin/options/' . $fieldSpec['pseudoconstant']['optionGroupName'];
     } elseif (!empty($fieldSpec['pseudoconstant']['table'])) {
         $daoName = CRM_Core_DAO_AllCoreTables::getClassForTable($fieldSpec['pseudoconstant']['table']);
         if (!$daoName) {
             return NULL;
         }
         // We don't have good mapping so have to do a bit of guesswork from the menu
         list(, $parent, , $child) = explode('_', $daoName);
         $sql = "SELECT path FROM civicrm_menu\n        WHERE page_callback LIKE '%CRM_Admin_Page_{$child}%' OR page_callback LIKE '%CRM_{$parent}_Page_{$child}%'\n        ORDER BY page_callback\n        LIMIT 1";
         return CRM_Core_Dao::singleValueQuery($sql);
     }
     return NULL;
 }
開發者ID:archcidburnziso,項目名稱:civicrm-core,代碼行數:22,代碼來源:PseudoConstant.php


注:本文中的CRM_Core_DAO_AllCoreTables類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。