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


PHP MetaModel::IsStandaloneClass方法代码示例

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


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

示例1: RenameClassInDB

 /**
  * Helper to complete the renaming of a class
  * The renaming is made in the datamodel definition, but the name has to be changed in the DB as well	 	 
  * Must be called after DB update, i.e within an implementation of AfterDatabaseCreation()
  * 	 
  * @param string $sFrom Original name (already INVALID in the current datamodel)	 	
  * @param string $sTo New name (valid in the current datamodel)
  * @return void	 	 	
  */
 public static function RenameClassInDB($sFrom, $sTo)
 {
     if (!MetaModel::IsStandaloneClass($sTo)) {
         $sRootClass = MetaModel::GetRootClass($sTo);
         $sTableName = MetaModel::DBGetTable($sRootClass);
         $sFinalClassCol = MetaModel::DBGetClassField($sRootClass);
         $sRepair = "UPDATE `{$sTableName}` SET `{$sFinalClassCol}` = '{$sTo}' WHERE `{$sFinalClassCol}` = BINARY '{$sFrom}'";
         CMDBSource::Query($sRepair);
         $iAffectedRows = CMDBSource::AffectedRows();
         SetupPage::log_info("Renaming class in DB - final class from '{$sFrom}' to '{$sTo}': {$iAffectedRows} rows affected");
     }
 }
开发者ID:kira8565,项目名称:ITOP203-ZHCN,代码行数:21,代码来源:moduleinstaller.class.inc.php

示例2: RenameClassInDB

 /**
  * Helper to complete the renaming of a class
  * The renaming is made in the datamodel definition, but the name has to be changed in the DB as well	 	 
  * Must be called after DB update, i.e within an implementation of AfterDatabaseCreation()
  * 	 
  * @param string $sFrom Original name (already INVALID in the current datamodel)	 	
  * @param string $sTo New name (valid in the current datamodel)
  * @return void	 	 	
  */
 public static function RenameClassInDB($sFrom, $sTo)
 {
     try {
         if (!MetaModel::IsStandaloneClass($sTo)) {
             $sRootClass = MetaModel::GetRootClass($sTo);
             $sTableName = MetaModel::DBGetTable($sRootClass);
             $sFinalClassCol = MetaModel::DBGetClassField($sRootClass);
             $sRepair = "UPDATE `{$sTableName}` SET `{$sFinalClassCol}` = '{$sTo}' WHERE `{$sFinalClassCol}` = BINARY '{$sFrom}'";
             CMDBSource::Query($sRepair);
             $iAffectedRows = CMDBSource::AffectedRows();
             SetupPage::log_info("Renaming class in DB - final class from '{$sFrom}' to '{$sTo}': {$iAffectedRows} rows affected");
         }
     } catch (Exception $e) {
         SetupPage::log_warning("Failed to rename class in DB - final class from '{$sFrom}' to '{$sTo}'. Reason: " . $e->getMessage());
     }
 }
开发者ID:leandroborgeseng,项目名称:bhtm,代码行数:25,代码来源:moduleinstaller.class.inc.php

示例3: OptimizeColumnLoad

 /**
  * Specify the subset of attributes to load (for each class of objects) before performing the SQL query for retrieving the rows from the DB
  * 
  * @param hash $aAttToLoad Format: alias => array of attribute_codes
  * 
  * @return void
  */
 public function OptimizeColumnLoad($aAttToLoad)
 {
     if (is_null($aAttToLoad)) {
         $this->m_aAttToLoad = null;
     } else {
         // Complete the attribute list with the attribute codes
         $aAttToLoadWithAttDef = array();
         foreach ($this->m_oFilter->GetSelectedClasses() as $sClassAlias => $sClass) {
             $aAttToLoadWithAttDef[$sClassAlias] = array();
             if (array_key_exists($sClassAlias, $aAttToLoad)) {
                 $aAttList = $aAttToLoad[$sClassAlias];
                 foreach ($aAttList as $sAttToLoad) {
                     $oAttDef = MetaModel::GetAttributeDef($sClass, $sAttToLoad);
                     $aAttToLoadWithAttDef[$sClassAlias][$sAttToLoad] = $oAttDef;
                     if ($oAttDef->IsExternalKey()) {
                         // Add the external key friendly name anytime
                         $oFriendlyNameAttDef = MetaModel::GetAttributeDef($sClass, $sAttToLoad . '_friendlyname');
                         $aAttToLoadWithAttDef[$sClassAlias][$sAttToLoad . '_friendlyname'] = $oFriendlyNameAttDef;
                     }
                 }
             }
             // Add the friendly name anytime
             $oFriendlyNameAttDef = MetaModel::GetAttributeDef($sClass, 'friendlyname');
             $aAttToLoadWithAttDef[$sClassAlias]['friendlyname'] = $oFriendlyNameAttDef;
             // Make sure that the final class is requested anytime, whatever the specification (needed for object construction!)
             if (!MetaModel::IsStandaloneClass($sClass) && !array_key_exists('finalclass', $aAttToLoadWithAttDef[$sClassAlias])) {
                 $aAttToLoadWithAttDef[$sClassAlias]['finalclass'] = MetaModel::GetAttributeDef($sClass, 'finalclass');
             }
         }
         $this->m_aAttToLoad = $aAttToLoadWithAttDef;
     }
 }
开发者ID:henryavila,项目名称:itop,代码行数:39,代码来源:dbobjectset.class.php

示例4: DisplayClassesList

/**
 * Display the list of classes from the business model
 */
function DisplayClassesList($oPage, $sContext)
{
    $oPage->add("<h1>" . Dict::S('UI:Schema:Title') . "</h1>\n");
    $oPage->add("<ul id=\"ClassesList\" class=\"treeview fileview\">\n");
    // Get all the "root" classes for display
    $aRootClasses = array();
    foreach (MetaModel::GetClasses() as $sClassName) {
        if (MetaModel::IsRootClass($sClassName)) {
            $aRootClasses[$sClassName] = MetaModel::GetName($sClassName);
        } elseif (MetaModel::IsStandaloneClass($sClassName)) {
            $aRootClasses[$sClassName] = MetaModel::GetName($sClassName);
        }
    }
    // Sort them alphabetically on their display name
    asort($aRootClasses);
    foreach ($aRootClasses as $sClassName => $sDisplayName) {
        if (MetaModel::IsRootClass($sClassName)) {
            $oPage->add("<li class=\"open\">" . MakeClassHLink($sClassName, $sContext) . "\n");
            DisplaySubclasses($oPage, $sClassName, $sContext);
            $oPage->add("</li>\n");
        } elseif (MetaModel::IsStandaloneClass($sClassName)) {
            $oPage->add("<li>" . MakeClassHLink($sClassName, $sContext) . "</li>\n");
        }
    }
    $oPage->add("</ul>\n");
    $oPage->add("<h1>" . Dict::S('UI:Schema:Relationships') . "</h1>\n");
    $oPage->add("<ul id=\"ClassesRelationships\" class=\"treeview\">\n");
    foreach (MetaModel::EnumRelations() as $sRelCode) {
        $oPage->add("<li>" . MakeRelationHLink($sRelCode, $sContext) . "\n");
        $oPage->add("<ul>\n");
        $oPage->add("<li>Description: " . htmlentities(MetaModel::GetRelationDescription($sRelCode), ENT_QUOTES, 'UTF-8') . "</li>\n");
        $oPage->add("<li>Verb up: " . htmlentities(MetaModel::GetRelationVerbUp($sRelCode), ENT_QUOTES, 'UTF-8') . "</li>\n");
        $oPage->add("<li>Verb down: " . htmlentities(MetaModel::GetRelationVerbDown($sRelCode), ENT_QUOTES, 'UTF-8') . "</li>\n");
        $oPage->add("</ul>\n");
        $oPage->add("</li>\n");
    }
    $oPage->add("</ul>\n");
    $oPage->add_ready_script('$("#ClassesList").treeview();');
    $oPage->add_ready_script('$("#ClassesRelationships").treeview();');
}
开发者ID:kira8565,项目名称:ITOP203-ZHCN,代码行数:43,代码来源:schema.php


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