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


PHP VardefManager::linkFields方法代码示例

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


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

示例1: createRelationship

 private function createRelationship($lhs_module, $rhs_module = null, $relationship_type = 'one-to-many')
 {
     $rhs_module = $rhs_module == null ? $lhs_module : $rhs_module;
     // Adding relation between products and users
     $this->relationships = new DeployedRelationships($lhs_module);
     $definition = array('lhs_module' => $lhs_module, 'relationship_type' => $relationship_type, 'rhs_module' => $rhs_module, 'lhs_label' => $lhs_module, 'rhs_label' => $rhs_module, 'rhs_subpanel' => 'default');
     $this->relationship = RelationshipFactory::newRelationship($definition);
     $this->relationships->add($this->relationship);
     $this->relationships->save();
     $this->relationships->build();
     LanguageManager::clearLanguageCache($lhs_module);
     // Updating $dictionary by created relation
     global $dictionary;
     $moduleInstaller = new ModuleInstaller();
     $moduleInstaller->silent = true;
     $moduleInstaller->rebuild_tabledictionary();
     require 'modules/TableDictionary.php';
     // Updating vardefs
     VardefManager::$linkFields = array();
     VardefManager::clearVardef();
     VardefManager::refreshVardefs($lhs_module, BeanFactory::getObjectName($lhs_module));
     if ($lhs_module != $rhs_module) {
         VardefManager::refreshVardefs($rhs_module, BeanFactory::getObjectName($rhs_module));
     }
     SugarRelationshipFactory::rebuildCache();
 }
开发者ID:delkyd,项目名称:sugarcrm_dev,代码行数:26,代码来源:Bug53223Test.php

示例2: createRelationship

 /**
  * Create a relationship
  *
  * Params should be passed in as this:
  *
  * array(
  *       'relationship_type' => 'one-to-many',
  *       'lhs_module' => 'Accounts',
  *       'rhs_module' => 'Accounts',
  *   )
  *
  * @static
  * @param array $relationship_def
  * @return ActivitiesRelationship|bool|ManyToManyRelationship|ManyToOneRelationship|OneToManyRelationship|OneToOneRelationship
  */
 public static function createRelationship(array $relationship_def)
 {
     if (!self::checkRequiredFields($relationship_def)) {
         return false;
     }
     $relationships = new DeployedRelationships($relationship_def['lhs_module']);
     if (!isset($relationship_def['view_module'])) {
         $relationship_def['view_module'] = $relationship_def['lhs_module'];
     }
     $REQUEST_Backup = $_REQUEST;
     $_REQUEST = $relationship_def;
     $relationship = $relationships->addFromPost();
     $relationships->save();
     $relationships->build();
     LanguageManager::clearLanguageCache($relationship_def['lhs_module']);
     SugarRelationshipFactory::rebuildCache();
     // rebuild the dictionary to make sure that it has the new relationship in it
     SugarTestHelper::setUp('dictionary');
     // reset the link fields since we added one
     VardefManager::$linkFields = array();
     $_REQUEST = $REQUEST_Backup;
     unset($REQUEST_Backup);
     self::$_relsAdded[] = $relationship->getDefinition();
     return $relationship;
 }
开发者ID:delkyd,项目名称:sugarcrm_dev,代码行数:40,代码来源:SugarTestRelationshipUtilities.php

示例3: getLinkFieldsForModule

 /**
  * @static
  * @param  $module
  * @param  $object
  * @return array|bool  returns a list of all fields in the module of type 'link'.
  */
 protected static function getLinkFieldsForModule($module, $object)
 {
     global $dictionary;
     //Some modules like cases have a bean name that doesn't match the object name
     if (empty($dictionary[$object])) {
         $newName = BeanFactory::getObjectName($module);
         $object = $newName != false ? $newName : $object;
     }
     if (empty($dictionary[$object])) {
         self::loadVardef($module, $object, false, array('ignore_rel_calc_fields' => true));
     }
     if (empty($dictionary[$object])) {
         $GLOBALS['log']->debug("Failed to load vardefs for {$module}:{$object} in linkFieldsForModule<br/>");
         return false;
     }
     //Cache link fields for this call in a static variable
     if (!isset(self::$linkFields)) {
         self::$linkFields = array();
     }
     if (isset(self::$linkFields[$object])) {
         return self::$linkFields[$object];
     }
     $vardef = $dictionary[$object];
     $links = array();
     foreach ($vardef['fields'] as $name => $def) {
         //Look through all link fields for related modules that have calculated fields that use that relationship
         if (!empty($def['type']) && $def['type'] == 'link' && !empty($def['relationship'])) {
             $links[$name] = $def;
         }
     }
     self::$linkFields[$object] = $links;
     return $links;
 }
开发者ID:omusico,项目名称:sugar_work,代码行数:39,代码来源:VardefManager.php

示例4: tearDown_relation

 /**
  * Doing the same things like setUp but for initialized list of modules
  *
  * @static
  * @return bool are caches refreshed or not
  */
 protected static function tearDown_relation()
 {
     SugarRelationshipFactory::deleteCache();
     $modules = array_unique(self::$cleanModules);
     foreach ($modules as $module) {
         LanguageManager::clearLanguageCache($module);
     }
     self::tearDown('dictionary');
     VardefManager::$linkFields = array();
     VardefManager::clearVardef();
     foreach ($modules as $module) {
         VardefManager::refreshVardefs($module, BeanFactory::getBeanName($module));
     }
     SugarRelationshipFactory::rebuildCache();
     self::$cleanModules = array();
     return true;
 }
开发者ID:sunmo,项目名称:snowlotus,代码行数:23,代码来源:SugarTestHelper.php

示例5: getLinkFieldsForModule

 /**
  * @static
  * @param  $module
  * @param  $object
  * @return array|bool  returns a list of all fields in the module of type 'link'.
  */
 protected static function getLinkFieldsForModule($module, $object)
 {
     global $dictionary;
     if ($object == 'aCase') {
         $object = 'Case';
     }
     if (empty($dictionary[$object])) {
         self::loadVardef($module, $object, false, array('ignore_rel_calc_fields' => true));
     }
     if (empty($dictionary[$object])) {
         $GLOBALS['log']->debug("Failed to load vardefs for {$module}:{$object} in linkFieldsForModule<br/>");
         return false;
     }
     //Cache link fields for this call in a static variable
     if (!isset(self::$linkFields)) {
         self::$linkFields = array();
     }
     if (isset(self::$linkFields[$object])) {
         return self::$linkFields[$object];
     }
     $vardef = $dictionary[$object];
     $links = array();
     foreach ($vardef['fields'] as $name => $def) {
         //Look through all link fields for related modules that have calculated fields that use that relationship
         if (!empty($def['type']) && $def['type'] == 'link' && !empty($def['relationship'])) {
             $links[$name] = $def;
         }
     }
     return $links;
 }
开发者ID:razorinc,项目名称:sugarcrm-example,代码行数:36,代码来源:VardefManager.php


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