core/xpdo/om/sqlsrv/xpdogenerator.class.php
sqlsrv classes for generating xPDOObject classes and maps from an xPDO schema.
- Package
- xpdo
- Subpackage
- om.sqlsrv
\xPDOGenerator_sqlsrv
An extension for generating {@link xPDOObject} class and map files for sqlsrv.
A sqlsrv-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
string
$aliasKey= ''''
''
Details- Type
- string
- Inherited_from
- \xPDOGenerator::$$aliasKey
string
$className= ''''
''
Details- Type
- string
- Inherited_from
- \xPDOGenerator::$$className
string
$classTemplate= ''''
''
Details- Type
- string
- Inherited_from
- \xPDOGenerator::$$classTemplate
array
$classes= 'array ()'
array ()
Details- Type
- array
- Inherited_from
- \xPDOGenerator::$$classes
string
$fieldKey= ''''
''
Details- Type
- string
- Inherited_from
- \xPDOGenerator::$$fieldKey
string
$indexName= ''''
''
Details- Type
- string
- Inherited_from
- \xPDOGenerator::$$indexName
\xPDOManager
$manager= 'null'
null
Details- Type
- \xPDOManager
- Inherited_from
- \xPDOGenerator::$$manager
array
$map= 'array ()'
array ()
Details- Type
- array
- Inherited_from
- \xPDOGenerator::$$map
string
$mapFooter= ''''
''
Details- Type
- string
- Inherited_from
- \xPDOGenerator::$$mapFooter
string
$mapHeader= ''''
''
Details- Type
- string
- Inherited_from
- \xPDOGenerator::$$mapHeader
string
$metaTemplate= ''''
''
Details- Type
- string
- Inherited_from
- \xPDOGenerator::$$metaTemplate
array
$model= 'array ()'
array ()
Details- Type
- array
- Inherited_from
- \xPDOGenerator::$$model
string
$outputDir= ''''
''
Details- Type
- string
- Inherited_from
- \xPDOGenerator::$$outputDir
string
$platformTemplate= ''''
''
Details- Type
- string
- Inherited_from
- \xPDOGenerator::$$platformTemplate
string
$schemaContent= ''''
''
Details- Type
- string
- Inherited_from
- \xPDOGenerator::$$schemaContent
string
$schemaFile= ''''
''
Details- Type
- string
- Inherited_from
- \xPDOGenerator::$$schemaFile
\xPDOSchemaManager
$schemaManager= 'null'
null
Details- Type
- \xPDOSchemaManager
- Inherited_from
- \xPDOGenerator::$$schemaManager
\xmlParser
$xmlParser= 'null'
null
Details- Type
- \xmlParser
- Inherited_from
- \xPDOGenerator::$$xmlParser
Methods
__construct(
\xPDOManager $manager
)
:
\xPDOGenerator
Name | Type | Description |
---|---|---|
$manager | \xPDOManager | &$manager A reference to a valid xPDOManager instance. |
Type | Description |
---|---|
\xPDOGenerator |
- Access
- protected
_handleCData(
$parser, $data
)
:
void
Name | Type | Description |
---|---|---|
$parser | ||
$data |
- Access
- protected
_handleCloseElement(
$parser, $element
)
:
void
Name | Type | Description |
---|---|---|
$parser | ||
$element |
- Access
- protected
_handleOpenElement(
\xmlParser $parser, string $element, array $attributes
)
:
void
Handles formatting of the open XML element.
Inherited from: \xPDOGenerator::_handleOpenElement()Name | Type | Description |
---|---|---|
$parser | \xmlParser | &$parser |
$element | string | &$element |
$attributes | array | &$attributes |
- Access
- protected
compile(
string $path
=
''
)
:
boolean
Compile the packages into a single file for quicker loading.
Name | Type | Description |
---|---|---|
$path | string | The absolute path to compile into. |
Type | Description |
---|---|
boolean | True if the compiling went successfully. |
getClassName(
string $string
)
:
string
Gets a class name from a table name by splitting the string by _ and capitalizing each token.
Inherited from: \xPDOGenerator::getClassName()Name | Type | Description |
---|---|---|
$string | string | The table name to format. |
Type | Description |
---|---|
string | The formatted string. |
- Access
- public
getClassPlatformTemplate(
$platform
)
:
string
Return the class platform template for the class files.
Inherited from: \xPDOGenerator::getClassPlatformTemplate()Name | Type | Description |
---|---|---|
$platform |
Type | Description |
---|---|
string | The class platform template. |
- Access
- public
getClassTemplate(
)
:
string
Return the class template for the class files.
Inherited from: \xPDOGenerator::getClassTemplate()Type | Description |
---|---|
string | The class template. |
- Access
- public
getDefault(
string $value
)
:
string
Format the passed default value as an XML attribute.
Inherited from: \xPDOGenerator::getDefault()Override this in different PDO driver implementations if necessary.
Name | Type | Description |
---|---|---|
$value | string | The value to encapsulate in the default tag. |
Type | Description |
---|---|
string | The parsed XML string |
- Access
- public
getIndex(
string $index
)
:
string
Format the passed database index value as an XML attribute.
Name | Type | Description |
---|---|---|
$index | string | The DB representation string of the index |
Type | Description |
---|---|
string | The formatted XML attribute string |
getMapFooter(
)
:
string
Type | Description |
---|---|
string | The map footer template. |
- Access
- public
getMapHeader(
)
:
string
Type | Description |
---|---|
string | The map header template. |
- Access
- public
getMetaTemplate(
)
:
string
Type | Description |
---|---|
string | The meta template. |
- Access
- public
getTableName(
string $string, string $prefix
=
'', boolean $prefixRequired
=
false
)
:
string
Formats a class name to a specific value, stripping the prefix if specified.
Inherited from: \xPDOGenerator::getTableName()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. |
Type | Description |
---|---|
string | The formatting string. |
- Access
- public
outputClasses(
string $path
)
:
void
Write the generated class files to the specified path.
Inherited from: \xPDOGenerator::outputClasses()Name | Type | Description |
---|---|---|
$path | string | An absolute path to write the generated class files to. |
- Access
- public
outputMaps(
string $path
)
:
void
Write the generated class maps to the specified path.
Inherited from: \xPDOGenerator::outputMaps()Name | Type | Description |
---|---|---|
$path | string | An absolute path to write the generated maps to. |
- Access
- public
outputMeta(
string $path
)
:
bool
Write the generated meta map to the specified path.
Inherited from: \xPDOGenerator::outputMeta()Name | Type | Description |
---|---|---|
$path | string | An absolute path to write the generated maps to. |
Type | Description |
---|---|
bool |
parseSchema(
string $schemaFile, string $outputDir
=
'', boolean $compile
=
false
)
:
boolean
Parses an XPDO XML schema and generates classes and map files from it.
Inherited from: \xPDOGenerator::parseSchema()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. |
Type | Description |
---|---|
boolean | True on success, false on failure. |
writeSchema(
string $schemaFile, string $package
=
'', string $baseClass
=
'', string $tablePrefix
=
'', boolean $restrictPrefix
=
false
)
:
boolean
Write an xPDO XML Schema from your database.
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. |
Type | Description |
---|---|
boolean | True on success, false on failure. |