core/xpdo/om/xpdogenerator.class.php

Show: inherited
Table of Contents

Class for reverse and forward engineering xPDO domain models.

Package
xpdo  
Subpackage
om  

\xPDOGenerator

Package: xpdo\om

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.

Children
\xPDOGenerator_sqlite
\xPDOGenerator_mysql
\xPDOGenerator_sqlsrv
Abstract
 

Properties

Propertypublicstring  $aliasKey= ''''

A placeholder for the current alias key.
Default value''Details
Type
string
Propertypublicstring  $className= ''''

A placeholder for the current class name.
Default value''Details
Type
string
Propertypublicstring  $classTemplate= ''''

The class template string to build the class files from.
Default value''Details
Type
string
Propertypublicarray  $classes= 'array ()'

The stored classes array.
Default valuearray ()Details
Type
array
Propertypublicstring  $fieldKey= ''''

A placeholder for the current field key.
Default value''Details
Type
string
Propertypublicstring  $indexName= ''''

A placeholder for the current index name.
Default value''Details
Type
string
Propertypublic\xPDOManager  $manager= 'null'

A reference to the xPDOManager using this generator.
Default valuenullDetails
Type
\xPDOManager
Propertypublicarray  $map= 'array ()'

The stored map array.
Default valuearray ()Details
Type
array
Propertypublicstring  $mapFooter= ''''

The map footer string to build the map files from.
Default value''Details
Type
string
Propertypublicstring  $mapHeader= ''''

The map header string to build the map files from.
Default value''Details
Type
string
Propertypublicstring  $metaTemplate= ''''

The class platform template string to build the meta class map files from.
Default value''Details
Type
string
Propertypublicarray  $model= 'array ()'

The stored model array.
Default valuearray ()Details
Type
array
Propertypublicstring  $outputDir= ''''

The absolute path to output the class and map files to.
Default value''Details
Type
string
Propertypublicstring  $platformTemplate= ''''

The class platform template string to build the class platform files from.
Default value''Details
Type
string
Propertypublicstring  $schemaContent= ''''

The stored content of the newly-created schema file.
Default value''Details
Type
string
Propertypublicstring  $schemaFile= ''''

An absolute path to the schema file.
Default value''Details
Type
string
Propertypublic\xPDOSchemaManager  $schemaManager= 'null'

Default valuenullDetails
Type
\xPDOSchemaManager
Propertypublic\xmlParser  $xmlParser= 'null'

Default valuenullDetails
Type
\xmlParser

Methods

methodpublic__construct( \xPDOManager $manager ) : \xPDOGenerator

Constructor

Parameters
Name Type Description
$manager \xPDOManager

&$manager A reference to a valid xPDOManager instance.

Returns
Type Description
\xPDOGenerator
Details
Access
protected  
methodprotected_handleCData(  $parser,  $data ) : void

Handles the XML CDATA tags

Parameters
Name Type Description
$parser
$data
Details
Access
protected  
methodprotected_handleCloseElement(  $parser,  $element ) : void

Handles the closing of XML tags.

Parameters
Name Type Description
$parser
$element
Details
Access
protected  
methodprotected_handleOpenElement( \xmlParser $parser, string $element, array $attributes ) : void

Handles formatting of the open XML element.

Parameters
Name Type Description
$parser \xmlParser

&$parser

$element string

&$element

$attributes array

&$attributes

Details
Access
protected  
methodpubliccompile( string $path = '' ) : boolean
abstract

Compile the packages into a single file for quicker loading.

Parameters
Name Type Description
$path string

The absolute path to compile into.

Returns
Type Description
boolean True if the compiling went successfully.
Details
Abstract
 
Access
public  
methodpublicgetClassName( string $string ) : string

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

Parameters
Name Type Description
$string string

The table name to format.

Returns
Type Description
string The formatted string.
Details
Access
public  
methodpublicgetClassPlatformTemplate(  $platform ) : string

Return the class platform template for the class files.

Parameters
Name Type Description
$platform
Returns
Type Description
string The class platform template.
Details
Access
public  
methodpublicgetClassTemplate( ) : string

Return the class template for the class files.

Returns
Type Description
string The class template.
Details
Access
public  
methodpublicgetDefault( string $value ) : string

Format the passed default value as an XML attribute.

Override this in different PDO driver implementations if necessary.

Parameters
Name Type Description
$value string

The value to encapsulate in the default tag.

Returns
Type Description
string The parsed XML string
Details
Access
public  
methodpublicgetIndex( string $index ) : string
abstract

Format the passed database index value as an XML attribute.

Parameters
Name Type Description
$index string

The DB representation string of the index

Returns
Type Description
string The formatted XML attribute string
Details
Abstract
Implement this for specific PDO driver implementations.  
Access
public  
methodpublicgetMapFooter( ) : string

Gets the map footer template.

Returns
Type Description
string The map footer template.
Details
Access
public  
methodpublicgetMapHeader( ) : string

Gets the map header template.

Returns
Type Description
string The map header template.
Details
Access
public  
methodpublicgetMetaTemplate( ) : string

Gets the meta template.

Returns
Type Description
string The meta template.
Details
Access
public  
methodpublicgetTableName( string $string, string $prefix = '', boolean $prefixRequired = false ) : string

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

Parameters
Name Type Description
$string string

The name to format.

$prefix string

If specified, will strip the prefix out of the first argument.

$prefixRequired boolean

If true, will return a blank string if the prefix specified is not found.

Returns
Type Description
string The formatting string.
Details
Access
public  
methodpublicoutputClasses( string $path ) : void

Write the generated class files to the specified path.

Parameters
Name Type Description
$path string

An absolute path to write the generated class files to.

Details
Access
public  
methodpublicoutputMaps( string $path ) : void

Write the generated class maps to the specified path.

Parameters
Name Type Description
$path string

An absolute path to write the generated maps to.

Details
Access
public  
methodpublicoutputMeta( string $path ) : bool

Write the generated meta map to the specified path.

Parameters
Name Type Description
$path string

An absolute path to write the generated maps to.

Returns
Type Description
bool
methodpublicparseSchema( string $schemaFile, string $outputDir = '', boolean $compile = false ) : boolean

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

Parameters
Name Type Description
$schemaFile string

The name of the XML file representing the schema.

$outputDir string

The directory in which to generate the class and map files into.

$compile boolean

Create compiled copies of the classes and maps from the schema.

Returns
Type Description
boolean True on success, false on failure.
Documentation was generated by DocBlox 0.18.1.