Abstract Class xPDOGenerator

Description

A service for reverse and forward engineering xPDO domain models.

This service utilizes an xPDOManager instance to generate class stub and meta-data map files from a provided vanilla XML schema of a database structure. It can also reverse-engineer XML schemas from an existing database.

  • abstract:

Located in /xpdo/om/xpdogenerator.class.php (line 40)


	
			
Direct descendents
Class Description
 class xPDOGenerator_mysql An extension for generating xPDOObject class and map files for MySQL.
 class xPDOGenerator_sqlite An extension for generating xPDOObject class and map files for SQLite.
 class xPDOGenerator_sqlsrv An extension for generating xPDOObject class and map files for sqlsrv.
Variable Summary
 array $classes
 string $className
 string $fieldKey
 string $indexName
 array $map
 string $mapFooter
 string $mapHeader
 array $model
 string $outputDir
 string $schemaFile
 xPDOSchemaManager $schemaManager
 xmlParser $xmlParser
Method Summary
 boolean compile ([string $path = ''])
 string getClassName (string $string)
 string getClassPlatformTemplate ( $platform)
 string getClassTemplate ()
 string getDefault (string $value)
 string getIndex (string $index)
 string getMapFooter ()
 string getMapHeader ()
 string getTableName (string $string, [string $prefix = ''], [boolean $prefixRequired = false])
 void outputClasses (string $path)
 void outputMaps (string $path)
 boolean parseSchema (string $schemaFile, [string $outputDir = ''], [boolean $compile = false])
 void _handleCData ( &$parser,  &$data)
 void _handleCloseElement ( &$parser,  &$element)
 void _handleOpenElement (xmlParser &$parser, string &$element, array &$attributes)
Variables
array $classes = array () (line 93)
  • var: The stored classes array.
  • access: public
string $className = '' (line 102)
  • var: A placeholder for the current class name.
  • access: public
string $classTemplate = '' (line 72)
  • var: The class template string to build the class files from.
  • access: public
string $fieldKey = '' (line 106)
  • var: A placeholder for the current field key.
  • access: public
string $indexName = '' (line 110)
  • var: A placeholder for the current index name.
  • access: public
xPDOManager $manager = null (line 45)
  • var: A reference to the xPDOManager using this generator.
  • access: public
array $map = array () (line 97)
  • var: The stored map array.
  • access: public
string $mapFooter = '' (line 85)
  • var: The map footer string to build the map files from.
  • access: public
string $mapHeader = '' (line 81)
  • var: The map header string to build the map files from.
  • access: public
array $model = array () (line 89)
  • var: The stored model array.
  • access: public
string $outputDir = '' (line 58)
  • var: The absolute path to output the class and map files to.
  • access: public
string $platformTemplate = '' (line 77)
  • var: The class platform template string to build the class platform files from.
  • access: public
string $schemaContent = '' (line 67)
  • var: The stored content of the newly-created schema file.
  • access: public
string $schemaFile = '' (line 62)
  • var: An absolute path to the schema file.
  • access: public
xPDOSchemaManager $schemaManager = null (line 49)
  • access: public
xmlParser $xmlParser = null (line 53)
  • access: public
Methods
Constructor __construct (line 119)

Constructor

  • access: public
xPDOGenerator __construct (xPDOManager &$manager)
  • xPDOManager &$manager: A reference to a valid xPDOManager instance.
compile (line 615)

Compile the packages into a single file for quicker loading.

  • return: True if the compiling went successfully.
  • abstract:
  • access: public
boolean compile ([string $path = ''])
  • string $path: The absolute path to compile into.

Redefined in descendants as:
getClassName (line 153)

Gets a class name from a table name by splitting the string by _ and capitalizing each token.

  • return: The formatted string.
  • access: public
string getClassName (string $string)
  • string $string: The table name to format.
getClassPlatformTemplate (line 638)

Return the class platform template for the class files.

  • return: The class platform template.
  • access: public
string getClassPlatformTemplate ( $platform)
  • $platform
getClassTemplate (line 623)

Return the class template for the class files.

  • return: The class template.
  • access: public
string getClassTemplate ()
getDefault (line 173)

Format the passed default value as an XML attribute.

Override this in different PDO driver implementations if necessary.

  • return: The parsed XML string
  • access: public
string getDefault (string $value)
  • string $value: The value to encapsulate in the default tag.
getIndex (line 189)

Format the passed database index value as an XML attribute.

  • return: The formatted XML attribute string
  • abstract:
  • access: public
string getIndex (string $index)
  • string $index: The DB representation string of the index

Redefined in descendants as:
getMapFooter (line 668)

Gets the map footer template.

  • return: The map footer template.
  • access: public
string getMapFooter ()
getMapHeader (line 654)

Gets the map header template.

  • return: The map header template.
  • access: public
string getMapHeader ()
getTableName (line 135)

Formats a class name to a specific value, stripping the prefix if specified.

  • return: The formatting string.
  • access: public
string getTableName (string $string, [string $prefix = ''], [boolean $prefixRequired = false])
  • string $string: The name to format.
  • string $prefix: If specified, will strip the prefix out of the first argument.
  • boolean $prefixRequired: If true, will return a blank string if the prefix specified is not found.
outputClasses (line 454)

Write the generated class files to the specified path.

  • access: public
void outputClasses (string $path)
  • string $path: An absolute path to write the generated class files to.
outputMaps (line 554)

Write the generated class maps to the specified path.

  • access: public
void outputMaps (string $path)
  • string $path: An absolute path to write the generated maps to.
parseSchema (line 201)

Parses an XPDO XML schema and generates classes and map files from it.

  • return: True on success, false on failure.
  • access: public
boolean parseSchema (string $schemaFile, [string $outputDir = ''], [boolean $compile = false])
  • string $schemaFile: The name of the XML file representing the schema.
  • string $outputDir: The directory in which to generate the class and map files into.
  • boolean $compile: Create compiled copies of the classes and maps from the schema.
_handleCData (line 444)

Handles the XML CDATA tags

  • access: protected
void _handleCData ( &$parser,  &$data)
  • &$parser
  • &$data
_handleCloseElement (line 437)

Handles the closing of XML tags.

  • access: protected
void _handleCloseElement ( &$parser,  &$element)
  • &$parser
  • &$element
_handleOpenElement (line 254)

Handles formatting of the open XML element.

  • access: protected
void _handleOpenElement (xmlParser &$parser, string &$element, array &$attributes)
  • xmlParser &$parser
  • string &$element
  • array &$attributes

Documentation generated on Fri, 17 Jun 2011 10:04:07 -0600 by phpDocumentor 1.4.3