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


PHP QConvertNotation::PrefixFromType方法代码示例

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


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

示例1: AnalyzeTable


//.........这里部分代码省略.........
                             $objReference->IsType = true;
                         } else {
                             $objReference->IsType = false;
                         }
                         // Setup Table and Column names
                         $objReference->Table = $strReferencedTableName;
                         $objReference->Column = $objForeignKey->ReferenceColumnNameArray[0];
                         // Setup VariableType
                         $objReference->VariableType = $this->ClassNameFromTableName($strReferencedTableName);
                         // Setup PropertyName and VariableName
                         $objReference->PropertyName = $this->ReferencePropertyNameFromColumn($objColumn);
                         $objReference->VariableName = $this->ReferenceVariableNameFromColumn($objColumn);
                         // Add this reference to the column
                         $objColumn->Reference = $objReference;
                         // STEP 2: Setup the REVERSE Reference for Non Type-based References
                         if (!$objReference->IsType) {
                             // Retrieve the ReferencedTable object
                             //								$objReferencedTable = $this->objTableArray[strtolower($objReference->Table)];
                             $objReferencedTable = $this->GetTable($objReference->Table);
                             $objReverseReference = new QReverseReference();
                             $objReverseReference->KeyName = $objReference->KeyName;
                             $objReverseReference->Table = $strTableName;
                             $objReverseReference->Column = $strColumnName;
                             $objReverseReference->NotNull = $objColumn->NotNull;
                             $objReverseReference->Unique = $objColumn->Unique;
                             $objReverseReference->PropertyName = $this->PropertyNameFromColumn($this->GetColumn($strTableName, $strColumnName));
                             $objReverseReference->ObjectDescription = $this->CalculateObjectDescription($strTableName, $strColumnName, $strReferencedTableName, false);
                             $objReverseReference->ObjectDescriptionPlural = $this->CalculateObjectDescription($strTableName, $strColumnName, $strReferencedTableName, true);
                             $objReverseReference->VariableName = $this->ReverseReferenceVariableNameFromTable($objTable->Name);
                             $objReverseReference->VariableType = $this->ReverseReferenceVariableTypeFromTable($objTable->Name);
                             // For Special Case ReverseReferences, calculate Associated MemberVariableName and PropertyName...
                             // See if ReverseReference is due to an ORM-based Class Inheritence Chain
                             if (count($objTable->PrimaryKeyColumnArray) == 1 && $objColumn->PrimaryKey) {
                                 $objReverseReference->ObjectMemberVariable = QConvertNotation::PrefixFromType(QType::Object) . $objReverseReference->VariableType;
                                 $objReverseReference->ObjectPropertyName = $objReverseReference->VariableType;
                                 $objReverseReference->ObjectDescription = $objReverseReference->VariableType;
                                 $objReverseReference->ObjectDescriptionPlural = $this->Pluralize($objReverseReference->VariableType);
                                 // Otherwise, see if it's just plain ol' unique
                             } else {
                                 if ($objColumn->Unique) {
                                     $objReverseReference->ObjectMemberVariable = $this->CalculateObjectMemberVariable($strTableName, $strColumnName, $strReferencedTableName);
                                     $objReverseReference->ObjectPropertyName = $this->CalculateObjectPropertyName($strTableName, $strColumnName, $strReferencedTableName);
                                 }
                             }
                             // Add this ReverseReference to the referenced table's ReverseReferenceArray
                             $objArray = $objReferencedTable->ReverseReferenceArray;
                             array_push($objArray, $objReverseReference);
                             $objReferencedTable->ReverseReferenceArray = $objArray;
                         }
                     } else {
                         $this->strErrors .= sprintf("Foreign Key %s in table %s references a table %s that does not appear to exist.\n", $objForeignKey->KeyName, $strTableName, $objForeignKey->ReferenceTableName);
                     }
                 } else {
                     $this->strErrors .= sprintf("Foreign Key %s in table %s indexes on a column that does not appear to exist.\n", $objForeignKey->KeyName, $strTableName);
                 }
             }
         }
     }
     // Verify: Table Name is valid (alphanumeric + "_" characters only, must not start with a number)
     // and NOT a PHP Reserved Word
     $strMatches = array();
     preg_match('/' . $this->strPatternTableName . '/', $strTableName, $strMatches);
     if (count($strMatches) && $strMatches[0] == $strTableName && $strTableName != '_') {
         // Setup Reserved Words
         $strReservedWords = explode(',', QCodeGen::PhpReservedWords);
         for ($intIndex = 0; $intIndex < count($strReservedWords); $intIndex++) {
开发者ID:sarapsg,项目名称:prayuj,代码行数:67,代码来源:QDatabaseCodeGen.class.php

示例2: CalculateObjectMemberVariable

 protected function CalculateObjectMemberVariable($strTableName, $strColumnName, $strReferencedTableName)
 {
     return sprintf('%s%s%s%s', QConvertNotation::PrefixFromType(QType::Object), $this->strAssociatedObjectPrefix, $this->CalculateObjectDescription($strTableName, $strColumnName, $strReferencedTableName, false), $this->strAssociatedObjectSuffix);
 }
开发者ID:kmcelhinney,项目名称:qcodo,代码行数:4,代码来源:QCodeGenBase.class.php


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