classQCodeGenBase
QCodeGenBase Class Reference
Inherits QBaseClass.Inherited by QCodeGen.

Public Member Functions
- GenerateFiles ($strTemplatePrefix, $mixArgumentArray)
- GenerateFile ($strModuleName, $strFilename, $blnOverrideFlag, $mixArgumentArray, $blnSave=true)
- __get ($strName)
- __set ($strName, $mixValue)
Static Public Member Functions
- static GetSettingsXml ()
- static Run ($strSettingsXmlFilePath)
- static GenerateAggregate ()
Public Attributes
- const PhpReservedWords = 'new, null, break, return, switch, self, case, const, clone, continue, declare, default, echo, else, elseif, empty, exit, eval, if, try, throw, catch, public, private, protected, function, extends, foreach, for, while, do, var, class, static, abstract, isset, unset, implements, interface, instanceof, include, include_once, require, require_once, abstract, and, or, xor, array, list, false, true, global, parent, print, exception, namespace, goto, final, endif, endswitch, enddeclare, endwhile, use, as, endfor, endforeach, this'
- const TemplatesPath = '/codegen/templates/'
- const TemplatesPathCustom = '/codegen/templates/'
- const DebugMode = false
Static Public Attributes
- static $CodeGenArray
- static $SettingsFilePath
- static $RootErrors = ''
Protected Member Functions
- EvaluateSubTemplate ($strSubTemplateFilename, $strModuleName, $mixArgumentArray)
- EvaluateTemplate ($strTemplate, $strModuleName, $mixArgumentArray)
- ClassNameFromTableName ($strTableName)
- VariableNameFromColumn (QColumn $objColumn)
- PropertyNameFromColumn (QColumn $objColumn)
- TypeNameFromColumnName ($strName)
- ReferenceColumnNameFromColumn (QColumn $objColumn)
- ReferenceVariableNameFromColumn (QColumn $objColumn)
- ReferencePropertyNameFromColumn (QColumn $objColumn)
- VariableNameFromTable ($strTableName)
- ReverseReferenceVariableNameFromTable ($strTableName)
- ReverseReferenceVariableTypeFromTable ($strTableName)
- ParameterCleanupFromColumn (QColumn $objColumn, $blnIncludeEquality=false)
- ParameterListFromColumnArray ($objColumnArray)
- ImplodeObjectArray ($strGlue, $strPrefix, $strSuffix, $strProperty, $objArrayToImplode)
- TypeTokenFromTypeName ($strName)
- FormControlVariableNameForColumn (QColumn $objColumn)
- FormControlClassForColumn (QColumn $objColumn)
- FormControlVariableNameForUniqueReverseReference (QReverseReference $objReverseReference)
- FormControlVariableNameForManyToManyReference (QManyToManyReference $objManyToManyReference)
- FormLabelVariableNameForColumn (QColumn $objColumn)
- FormLabelVariableNameForUniqueReverseReference (QReverseReference $objReverseReference)
- FormLabelVariableNameForManyToManyReference (QManyToManyReference $objManyToManyReference)
- FormControlTypeForColumn (QColumn $objColumn)
- CalculateObjectMemberVariable ($strTableName, $strColumnName, $strReferencedTableName)
- CalculateObjectPropertyName ($strTableName, $strColumnName, $strReferencedTableName)
- CalculateObjectDescription ($strTableName, $strColumnName, $strReferencedTableName, $blnPluralize)
- CalculateObjectDescriptionForAssociation ($strAssociationTableName, $strTableName, $strReferencedTableName, $blnPluralize)
- CalculateGraphPrefixArray ($objForeignKeyArray)
- VariableTypeFromDbType ($strDbType)
- Pluralize ($strName)
Static Protected Member Functions
- static LookupSetting ($objNode, $strTagName, $strAttributeName=null, $strType=QType::String)
Protected Attributes
Static Protected Attributes
- static $SettingsXmlArray
- static $SettingsXml
- static $ApplicationName
- static $TemplateEscapeBegin
- static $TemplateEscapeBeginLength
- static $TemplateEscapeEnd
- static $TemplateEscapeEndLength
Detailed Description
This is the CodeGen class which performs the code generation for both the Object-Relational Model (e.g. Data Objects) as well as the draft Forms, which make up simple HTML/PHP scripts to perform basic CRUD functionality on each object.Member Function Documentation
| QCodeGenBase::__get | ( | $ | strName | ) |
Override method to perform a property "Get" This will get the value of $strName
- Parameters:
-
string strName Name of the property to get
- Returns:
- mixed
Reimplemented from QBaseClass.
Reimplemented in QDatabaseCodeGen, and QRestServiceCodeGen.
References QCallerException::IncrementOffset().
| QCodeGenBase::__set | ( | $ | strName, | |
| $ | mixValue | |||
| ) |
Override method to perform a property "Set" This will set the property $strName to be $mixValue All inhereted objects that call __set() should always fall through to calling parent::__set() in a try/catch statement catching for CallerExceptions.
- Parameters:
-
string $strName Name of the property to set string $mixValue New value of the property
- Returns:
- mixed the property that was set
Reimplemented from QBaseClass.
Reimplemented in QDatabaseCodeGen, and QRestServiceCodeGen.
References QType::Cast(), QCallerException::IncrementOffset(), and QType::String.
| QCodeGenBase::CalculateGraphPrefixArray | ( | $ | objForeignKeyArray | ) | [protected] |
Referenced by QDatabaseCodeGen::AnalyzeAssociationTable().
| QCodeGenBase::CalculateObjectDescription | ( | $ | strTableName, | |
| $ | strColumnName, | |||
| $ | strReferencedTableName, | |||
| $ | blnPluralize | |||
| ) | [protected] |
References QConvertNotationBase::CamelCaseFromUnderscore(), and Pluralize().
Referenced by QDatabaseCodeGen::AnalyzeTable(), CalculateObjectMemberVariable(), and CalculateObjectPropertyName().
| QCodeGenBase::CalculateObjectDescriptionForAssociation | ( | $ | strAssociationTableName, | |
| $ | strTableName, | |||
| $ | strReferencedTableName, | |||
| $ | blnPluralize | |||
| ) | [protected] |
References QConvertNotationBase::CamelCaseFromUnderscore(), and Pluralize().
Referenced by QDatabaseCodeGen::AnalyzeAssociationTable().
| QCodeGenBase::CalculateObjectMemberVariable | ( | $ | strTableName, | |
| $ | strColumnName, | |||
| $ | strReferencedTableName | |||
| ) | [protected] |
References CalculateObjectDescription(), QType::Object, and QConvertNotationBase::PrefixFromType().
Referenced by QDatabaseCodeGen::AnalyzeTable().
| QCodeGenBase::CalculateObjectPropertyName | ( | $ | strTableName, | |
| $ | strColumnName, | |||
| $ | strReferencedTableName | |||
| ) | [protected] |
| QCodeGenBase::ClassNameFromTableName | ( | $ | strTableName | ) | [protected] |
| QCodeGenBase::EvaluateSubTemplate | ( | $ | strSubTemplateFilename, | |
| $ | strModuleName, | |||
| $ | mixArgumentArray | |||
| ) | [protected] |
References _p(), DebugMode, EvaluateTemplate(), TemplatesPath, and TemplatesPathCustom.
Referenced by EvaluateTemplate().
| QCodeGenBase::EvaluateTemplate | ( | $ | strTemplate, | |
| $ | strModuleName, | |||
| $ | mixArgumentArray | |||
| ) | [protected] |
References $TemplateEscapeBegin, $TemplateEscapeBeginLength, $TemplateEscapeEnd, $TemplateEscapeEndLength, _p(), DebugMode, EvaluateSubTemplate(), QString::FirstCharacter(), and QString::LastCharacter().
Referenced by EvaluateSubTemplate(), and GenerateFile().
| QCodeGenBase::FormControlClassForColumn | ( | QColumn $ | objColumn | ) | [protected] |
References QType::Boolean, QType::DateTime, QType::Float, and QType::Integer.
| QCodeGenBase::FormControlTypeForColumn | ( | QColumn $ | objColumn | ) | [protected] |
References QType::Boolean, QType::DateTime, QType::Float, QType::Integer, and QType::String.
| QCodeGenBase::FormControlVariableNameForColumn | ( | QColumn $ | objColumn | ) | [protected] |
References QType::Boolean, and QType::DateTime.
| QCodeGenBase::FormControlVariableNameForManyToManyReference | ( | QManyToManyReference $ | objManyToManyReference | ) | [protected] |
| QCodeGenBase::FormControlVariableNameForUniqueReverseReference | ( | QReverseReference $ | objReverseReference | ) | [protected] |
| QCodeGenBase::FormLabelVariableNameForColumn | ( | QColumn $ | objColumn | ) | [protected] |
| QCodeGenBase::FormLabelVariableNameForManyToManyReference | ( | QManyToManyReference $ | objManyToManyReference | ) | [protected] |
| QCodeGenBase::FormLabelVariableNameForUniqueReverseReference | ( | QReverseReference $ | objReverseReference | ) | [protected] |
| static QCodeGenBase::GenerateAggregate | ( | ) | [static] |
References $CodeGenArray, and QDatabaseCodeGen::GenerateAggregateHelper().
| QCodeGenBase::GenerateFile | ( | $ | strModuleName, | |
| $ | strFilename, | |||
| $ | blnOverrideFlag, | |||
| $ | mixArgumentArray, | |||
| $ | blnSave = true | |||
| ) |
Enter description here...
- Parameters:
-
string $strModuleName string $strFilename boolean $blnOverrideFlag whether we are using the _core template, or using a custom one mixed[] $mixArgumentArray boolean $blnSave wheather or not to actually perform the save
- Returns:
- mixed returns the evaluated template or boolean save success.
References _p(), QType::Boolean, QType::Cast(), DebugMode, EvaluateTemplate(), QType::String, TemplatesPath, and TemplatesPathCustom.
Referenced by GenerateFiles().
| QCodeGenBase::GenerateFiles | ( | $ | strTemplatePrefix, | |
| $ | mixArgumentArray | |||
| ) |
Given a template prefix (e.g. db_orm_, db_type_, rest_, soap_, etc.), pull all the _*.tpl templates from any subfolders of the template prefix in QCodeGen::TemplatesPath and QCodeGen::TemplatesPathCustom, and call GenerateFile() on each one. If there are any template files that reside in BOTH TemplatesPath AND TemplatesPathCustom, then only use the TemplatesPathCustom one (which in essence overrides the one in TemplatesPath).
- Parameters:
-
string $strTemplatePrefix the prefix of the templates you want to generate against mixed[] $mixArgumentArray array of arguments to send to EvaluateTemplate
- Returns:
- boolean success/failure on whether or not all the files generated successfully
References QString::FirstCharacter(), GenerateFile(), TemplatesPath, and TemplatesPathCustom.
Referenced by QDatabaseCodeGen::GenerateAggregateHelper(), QDatabaseCodeGen::GenerateTable(), and QDatabaseCodeGen::GenerateTypeTable().
| static QCodeGenBase::GetSettingsXml | ( | ) | [static] |
References $ApplicationName, $CodeGenArray, $TemplateEscapeBegin, and $TemplateEscapeEnd.
| QCodeGenBase::ImplodeObjectArray | ( | $ | strGlue, | |
| $ | strPrefix, | |||
| $ | strSuffix, | |||
| $ | strProperty, | |||
| $ | objArrayToImplode | |||
| ) | [protected] |
Referenced by ParameterListFromColumnArray().
| static QCodeGenBase::LookupSetting | ( | $ | objNode, | |
| $ | strTagName, | |||
| $ | strAttributeName = null, |
|||
| $ | strType = QType::String | |||
| ) | [static, protected] |
This will lookup either the node value (if no attributename is passed in) or the attribute value for a given Tag. Node Searches only apply from the root level of the configuration XML being passed in (e.g. it will not be able to lookup the tag name of a grandchild of the root node)
If No Tag Name is passed in, then attribute/value lookup is based on the root node, itself.
- Parameters:
-
SimpleXmlElement $objNode string $strTagName string $strAttributeName string $strType
- Returns:
- mixed the return type depends on the QType you pass in to $strType
References QType::Boolean, QType::Cast(), QType::Integer, and QType::String.
Referenced by QRestServiceCodeGen::__construct(), QDatabaseCodeGen::__construct(), and Run().
| QCodeGenBase::ParameterCleanupFromColumn | ( | QColumn $ | objColumn, | |
| $ | blnIncludeEquality = false | |||
| ) | [protected] |
| QCodeGenBase::ParameterListFromColumnArray | ( | $ | objColumnArray | ) | [protected] |
References ImplodeObjectArray().
| QCodeGenBase::Pluralize | ( | $ | strName | ) | [protected] |
Reimplemented in QCodeGen.
Referenced by CalculateObjectDescription(), and CalculateObjectDescriptionForAssociation().
| QCodeGenBase::PropertyNameFromColumn | ( | QColumn $ | objColumn | ) | [protected] |
| QCodeGenBase::ReferenceColumnNameFromColumn | ( | QColumn $ | objColumn | ) | [protected] |
Referenced by ReferencePropertyNameFromColumn(), and ReferenceVariableNameFromColumn().
| QCodeGenBase::ReferencePropertyNameFromColumn | ( | QColumn $ | objColumn | ) | [protected] |
References QConvertNotationBase::CamelCaseFromUnderscore(), and ReferenceColumnNameFromColumn().
Referenced by QDatabaseCodeGen::AnalyzeTable().
| QCodeGenBase::ReferenceVariableNameFromColumn | ( | QColumn $ | objColumn | ) | [protected] |
| QCodeGenBase::ReverseReferenceVariableNameFromTable | ( | $ | strTableName | ) | [protected] |
References VariableNameFromTable().
Referenced by QDatabaseCodeGen::AnalyzeAssociationTable(), and QDatabaseCodeGen::AnalyzeTable().
| QCodeGenBase::ReverseReferenceVariableTypeFromTable | ( | $ | strTableName | ) | [protected] |
References ClassNameFromTableName().
Referenced by QDatabaseCodeGen::AnalyzeAssociationTable(), and QDatabaseCodeGen::AnalyzeTable().
| static QCodeGenBase::Run | ( | $ | strSettingsXmlFilePath | ) | [static] |
| QCodeGenBase::TypeNameFromColumnName | ( | $ | strName | ) | [protected] |
References QConvertNotationBase::CamelCaseFromUnderscore().
Referenced by QDatabaseCodeGen::AnalyzeTypeTable().
| QCodeGenBase::TypeTokenFromTypeName | ( | $ | strName | ) | [protected] |
| QCodeGenBase::VariableNameFromColumn | ( | QColumn $ | objColumn | ) | [protected] |
| QCodeGenBase::VariableNameFromTable | ( | $ | strTableName | ) | [protected] |
References QConvertNotationBase::CamelCaseFromUnderscore(), QType::Object, and QConvertNotationBase::PrefixFromType().
Referenced by ReverseReferenceVariableNameFromTable().
| QCodeGenBase::VariableTypeFromDbType | ( | $ | strDbType | ) | [protected] |
References QDatabaseFieldType::Bit, QDatabaseFieldType::Blob, QType::Boolean, QDatabaseFieldType::Char, QDatabaseFieldType::Date, QDatabaseFieldType::DateTime, QType::DateTime, QType::Float, QDatabaseFieldType::Float, QType::Integer, QDatabaseFieldType::Integer, QType::String, QDatabaseFieldType::Time, and QDatabaseFieldType::VarChar.
Referenced by QDatabaseCodeGen::AnalyzeTableColumn().
Member Data Documentation
QCodeGenBase::$ApplicationName [static, protected] |
Referenced by GetSettingsXml(), and Run().
QCodeGenBase::$CodeGenArray [static] |
Referenced by QDatabaseCodeGen::AnalyzeDatabase(), GenerateAggregate(), GetSettingsXml(), and Run().
QCodeGenBase::$RootErrors = '' [static] |
Referenced by QcodoHandleCodeGenParseError(), and Run().
QCodeGenBase::$SettingsFilePath [static] |
Referenced by Run().
QCodeGenBase::$SettingsXml [static, protected] |
Referenced by Run().
QCodeGenBase::$SettingsXmlArray [static, protected] |
QCodeGenBase::$strClassPrefix [protected] |
QCodeGenBase::$strClassSuffix [protected] |
QCodeGenBase::$strErrors [protected] |
QCodeGenBase::$TemplateEscapeBegin [static, protected] |
Referenced by EvaluateTemplate(), GetSettingsXml(), and Run().
QCodeGenBase::$TemplateEscapeBeginLength [static, protected] |
Referenced by EvaluateTemplate(), and Run().
QCodeGenBase::$TemplateEscapeEnd [static, protected] |
Referenced by EvaluateTemplate(), GetSettingsXml(), and Run().
QCodeGenBase::$TemplateEscapeEndLength [static, protected] |
Referenced by EvaluateTemplate(), and Run().
| const QCodeGenBase::DebugMode = false |
Referenced by EvaluateSubTemplate(), EvaluateTemplate(), and GenerateFile().
| const QCodeGenBase::PhpReservedWords = 'new, null, break, return, switch, self, case, const, clone, continue, declare, default, echo, else, elseif, empty, exit, eval, if, try, throw, catch, public, private, protected, function, extends, foreach, for, while, do, var, class, static, abstract, isset, unset, implements, interface, instanceof, include, include_once, require, require_once, abstract, and, or, xor, array, list, false, true, global, parent, print, exception, namespace, goto, final, endif, endswitch, enddeclare, endwhile, use, as, endfor, endforeach, this' |
Referenced by QDatabaseCodeGen::AnalyzeTable(), and QDatabaseCodeGen::AnalyzeTypeTable().
| const QCodeGenBase::TemplatesPath = '/codegen/templates/' |
Referenced by EvaluateSubTemplate(), GenerateFile(), and GenerateFiles().
| const QCodeGenBase::TemplatesPathCustom = '/codegen/templates/' |
Referenced by EvaluateSubTemplate(), GenerateFile(), and GenerateFiles().
The documentation for this class was generated from the following file:
- qcodo/_core/codegen/QCodeGenBase.class.php
