core/xpdo/om/mysql/xpdogenerator.class.php

Show: inherited
Table of Contents

MySQL classes for generating xPDOObject classes and maps from an xPDO schema.

Package
xpdo  
Subpackage
om.mysql  

\xPDOGenerator_mysql

Package: xpdo\om\mysql

An extension for generating {@link xPDOObject} class and map files for MySQL.

A MySQL-specific extension to an {@link xPDOManager} instance that can generate class stub and meta-data map files from a provided XML schema of a database structure.

Parent(s)
\xPDOGenerator

Properties

Propertypublicstring  $aliasKey= ''''
inherited

A placeholder for the current alias key.Inherited from: \xPDOGenerator::$$aliasKey
Default value''Details
Type
string
Inherited_from
\xPDOGenerator::$$aliasKey  
Propertypublicstring  $className= ''''
inherited

A placeholder for the current class name.Inherited from: \xPDOGenerator::$$className
Default value''Details
Type
string
Inherited_from
\xPDOGenerator::$$className  
Propertypublicstring  $classTemplate= ''''
inherited

The class template string to build the class files from.Inherited from: \xPDOGenerator::$$classTemplate
Default value''Details
Type
string
Inherited_from
\xPDOGenerator::$$classTemplate  
Propertypublicarray  $classes= 'array ()'
inherited

The stored classes array.Inherited from: \xPDOGenerator::$$classes
Default valuearray ()Details
Type
array
Inherited_from
\xPDOGenerator::$$classes  
Propertypublicstring  $fieldKey= ''''
inherited

A placeholder for the current field key.Inherited from: \xPDOGenerator::$$fieldKey
Default value''Details
Type
string
Inherited_from
\xPDOGenerator::$$fieldKey  
Propertypublicstring  $indexName= ''''
inherited

A placeholder for the current index name.Inherited from: \xPDOGenerator::$$indexName
Default value''Details
Type
string
Inherited_from
\xPDOGenerator::$$indexName  
Propertypublic\xPDOManager  $manager= 'null'
inherited

A reference to the xPDOManager using this generator.Inherited from: \xPDOGenerator::$$manager
Default valuenullDetails
Type
\xPDOManager
Inherited_from
\xPDOGenerator::$$manager  
Propertypublicarray  $map= 'array ()'
inherited

The stored map array.Inherited from: \xPDOGenerator::$$map
Default valuearray ()Details
Type
array
Inherited_from
\xPDOGenerator::$$map  
Propertypublicstring  $mapFooter= ''''
inherited

The map footer string to build the map files from.Inherited from: \xPDOGenerator::$$mapFooter
Default value''Details
Type
string
Inherited_from
\xPDOGenerator::$$mapFooter  
Propertypublicstring  $mapHeader= ''''
inherited

The map header string to build the map files from.Inherited from: \xPDOGenerator::$$mapHeader
Default value''Details
Type
string
Inherited_from
\xPDOGenerator::$$mapHeader  
Propertypublicstring  $metaTemplate= ''''
inherited

The class platform template string to build the meta class map files from.Inherited from: \xPDOGenerator::$$metaTemplate
Default value''Details
Type
string
Inherited_from
\xPDOGenerator::$$metaTemplate  
Propertypublicarray  $model= 'array ()'
inherited

The stored model array.Inherited from: \xPDOGenerator::$$model
Default valuearray ()Details
Type
array
Inherited_from
\xPDOGenerator::$$model  
Propertypublicstring  $outputDir= ''''
inherited

The absolute path to output the class and map files to.Inherited from: \xPDOGenerator::$$outputDir
Default value''Details
Type
string
Inherited_from
\xPDOGenerator::$$outputDir  
Propertypublicstring  $platformTemplate= ''''
inherited

The class platform template string to build the class platform files from.Inherited from: \xPDOGenerator::$$platformTemplate
Default value''Details
Type
string
Inherited_from
\xPDOGenerator::$$platformTemplate  
Propertypublicstring  $schemaContent= ''''
inherited

The stored content of the newly-created schema file.Inherited from: \xPDOGenerator::$$schemaContent
Default value''Details
Type
string
Inherited_from
\xPDOGenerator::$$schemaContent  
Propertypublicstring  $schemaFile= ''''
inherited

An absolute path to the schema file.Inherited from: \xPDOGenerator::$$schemaFile
Default value''Details
Type
string
Inherited_from
\xPDOGenerator::$$schemaFile  
Propertypublic\xPDOSchemaManager  $schemaManager= 'null'
inherited

Inherited from: \xPDOGenerator::$$schemaManager
Default valuenullDetails
Type
\xPDOSchemaManager
Inherited_from
\xPDOGenerator::$$schemaManager  
Propertypublic\xmlParser  $xmlParser= 'null'
inherited

Inherited from: \xPDOGenerator::$$xmlParser
Default valuenullDetails
Type
\xmlParser
Inherited_from
\xPDOGenerator::$$xmlParser  

Methods

methodpublic__construct( \xPDOManager $manager ) : \xPDOGenerator
inherited

Constructor

Inherited from: \xPDOGenerator::__construct()
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
inherited

Handles the XML CDATA tags

Inherited from: \xPDOGenerator::_handleCData()
Parameters
Name Type Description
$parser
$data
Details
Access
protected  
methodprotected_handleCloseElement(  $parser,  $element ) : void
inherited

Handles the closing of XML tags.

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

Handles formatting of the open XML element.

Inherited from: \xPDOGenerator::_handleOpenElement()
Parameters
Name Type Description
$parser \xmlParser

&$parser

$element string

&$element

$attributes array

&$attributes

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

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.
methodpublicgetClassName( string $string ) : string
inherited

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

Inherited from: \xPDOGenerator::getClassName()
Parameters
Name Type Description
$string string

The table name to format.

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

Return the class platform template for the class files.

Inherited from: \xPDOGenerator::getClassPlatformTemplate()
Parameters
Name Type Description
$platform
Returns
Type Description
string The class platform template.
Details
Access
public  
methodpublicgetClassTemplate( ) : string
inherited

Return the class template for the class files.

Inherited from: \xPDOGenerator::getClassTemplate()
Returns
Type Description
string The class template.
Details
Access
public  
methodpublicgetDefault( string $value ) : string
inherited

Format the passed default value as an XML attribute.

Inherited from: \xPDOGenerator::getDefault()

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

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
methodpublicgetMapFooter( ) : string
inherited

Gets the map footer template.

Inherited from: \xPDOGenerator::getMapFooter()
Returns
Type Description
string The map footer template.
Details
Access
public  
methodpublicgetMapHeader( ) : string
inherited

Gets the map header template.

Inherited from: \xPDOGenerator::getMapHeader()
Returns
Type Description
string The map header template.
Details
Access
public  
methodpublicgetMetaTemplate( ) : string
inherited

Gets the meta template.

Inherited from: \xPDOGenerator::getMetaTemplate()
Returns
Type Description
string The meta template.
Details
Access
public  
methodpublicgetTableName( string $string, string $prefix = '', boolean $prefixRequired = false ) : string
inherited

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

Inherited from: \xPDOGenerator::getTableName()
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
inherited

Write the generated class files to the specified path.

Inherited from: \xPDOGenerator::outputClasses()
Parameters
Name Type Description
$path string

An absolute path to write the generated class files to.

Details
Access
public  
methodpublicoutputMaps( string $path ) : void
inherited

Write the generated class maps to the specified path.

Inherited from: \xPDOGenerator::outputMaps()
Parameters
Name Type Description
$path string

An absolute path to write the generated maps to.

Details
Access
public  
methodpublicoutputMeta( string $path ) : bool
inherited

Write the generated meta map to the specified path.

Inherited from: \xPDOGenerator::outputMeta()
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
inherited

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

Inherited from: \xPDOGenerator::parseSchema()
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.
methodpublicwriteSchema( string $schemaFile, string $package = '', string $baseClass = '', string $tablePrefix = '', boolean $restrictPrefix = false ) : boolean

Write an xPDO XML Schema from your database.

Parameters
Name Type Description
$schemaFile string

The name (including path) of the schemaFile you want to write.

$package string

Name of the package to generate the classes in.

$baseClass string

The class which all classes in the package will extend; by default this is set to {@link xPDOObject} and any auto_increment fields with the column name 'id' will extend {@link xPDOSimpleObject} automatically.

$tablePrefix string

The table prefix for the current connection, which will be removed from all of the generated class and table names. Specify a prefix when creating a new {@link xPDO} instance to recreate the tables with the same prefix, but still use the generic class names.

$restrictPrefix boolean

Only reverse-engineer tables that have the specified tablePrefix; if tablePrefix is empty, this is ignored.

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