QCubed - A PHP5 rapid development MVC framework.
Home  |  Updates

classQCodeGenBase

QCodeGenBase Class Reference

Inherits QBaseClass.

Inherited by QCodeGen.

Collaboration diagram for QCodeGenBase:

List of all members.

Public Member Functions

  • GenerateFiles ($strTemplatePrefix, $mixArgumentArray)
  • GenerateFile ($strModuleName, $strFilename, $blnOverrideFlag, $mixArgumentArray, $blnSave=true)
  • __get ($strName)
  • __set ($strName, $mixValue)

Static Public Member Functions

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

Protected Member Functions

Static Protected Member Functions

Protected Attributes

Static Protected Attributes


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]

QCodeGenBase::CalculateObjectDescription ( strTableName,
strColumnName,
strReferencedTableName,
blnPluralize 
) [protected]

QCodeGenBase::CalculateObjectDescriptionForAssociation ( strAssociationTableName,
strTableName,
strReferencedTableName,
blnPluralize 
) [protected]

QCodeGenBase::CalculateObjectMemberVariable ( strTableName,
strColumnName,
strReferencedTableName 
) [protected]

QCodeGenBase::CalculateObjectPropertyName ( strTableName,
strColumnName,
strReferencedTableName 
) [protected]

QCodeGenBase::ClassNameFromTableName ( strTableName  )  [protected]

QCodeGenBase::EvaluateSubTemplate ( strSubTemplateFilename,
strModuleName,
mixArgumentArray 
) [protected]

QCodeGenBase::EvaluateTemplate ( strTemplate,
strModuleName,
mixArgumentArray 
) [protected]

QCodeGenBase::FormControlClassForColumn ( QColumn objColumn  )  [protected]

QCodeGenBase::FormControlTypeForColumn ( QColumn objColumn  )  [protected]

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]

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]

QCodeGenBase::ImplodeObjectArray ( strGlue,
strPrefix,
strSuffix,
strProperty,
objArrayToImplode 
) [protected]

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]

QCodeGenBase::ReferenceColumnNameFromColumn ( QColumn objColumn  )  [protected]

QCodeGenBase::ReferencePropertyNameFromColumn ( QColumn objColumn  )  [protected]

QCodeGenBase::ReferenceVariableNameFromColumn ( QColumn objColumn  )  [protected]

QCodeGenBase::ReverseReferenceVariableNameFromTable ( strTableName  )  [protected]

QCodeGenBase::ReverseReferenceVariableTypeFromTable ( strTableName  )  [protected]

QCodeGenBase::TypeNameFromColumnName ( strName  )  [protected]

QCodeGenBase::TypeTokenFromTypeName ( strName  )  [protected]

QCodeGenBase::VariableNameFromTable ( strTableName  )  [protected]


Member Data Documentation

QCodeGenBase::$ApplicationName [static, protected]

Referenced by GetSettingsXml(), and Run().

QCodeGenBase::$CodeGenArray [static]

QCodeGenBase::$RootErrors = '' [static]

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]

QCodeGenBase::$TemplateEscapeBeginLength [static, protected]

Referenced by EvaluateTemplate(), and Run().

QCodeGenBase::$TemplateEscapeEnd [static, protected]

QCodeGenBase::$TemplateEscapeEndLength [static, protected]

Referenced by EvaluateTemplate(), and Run().

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'

const QCodeGenBase::TemplatesPath = '/codegen/templates/'

const QCodeGenBase::TemplatesPathCustom = '/codegen/templates/'


The documentation for this class was generated from the following file: