class Doctrine_Import_Schema (View source)

Doctrine_Import_Schema

Class for importing Doctrine_Record classes from a yaml schema definition

Properties

static protected array $_globalDefinitionKeys Schema definition keys that can be applied at the global level.
protected array $_relations _relations
protected array $_options _options
protected array $_validation _validation

Methods

static array
getGlobalDefinitionKeys()

Returns an array of definition keys that can be applied at the global level.

void
getOption(string $name)

getOption

void
getOptions()

getOptions

void
setOption(string $name, string $value)

setOption

void
setOptions(string $options)

setOptions

array
buildSchema(string $schema, string $format)

buildSchema

void
importSchema(string $schema, string $format = 'yml', string $directory = null, array $models = array())

importSchema

array
parseSchema(string $schema, string $type)

parseSchema

void
_processInheritance(string $array)

_processInheritance

string
_findBaseSuperClass($array, $class)

Find the base super class for this inheritance child. We need to move all levels of children to the top most parent.

void
_buildRelationships(string $array)

buildRelationships

void
_autoCompleteOppositeRelations()

fixRelationships

void
_fixDuplicateRelations()

_fixDuplicateRelations

void
_buildUniqueRelationKey(string $relation)

_buildUniqueRelationKey

void
_validateSchemaElement($name, $element, $path)

_validateSchemaElement

Details

static array getGlobalDefinitionKeys()

Returns an array of definition keys that can be applied at the global level.

Return Value

array

void getOption(string $name)

getOption

Parameters

string $name

Return Value

void

void getOptions()

getOptions

Return Value

void

void setOption(string $name, string $value)

setOption

Parameters

string $name
string $value

Return Value

void

void setOptions(string $options)

setOptions

Parameters

string $options

Return Value

void

array buildSchema(string $schema, string $format)

buildSchema

Loop throug directories of schema files and parse them all in to one complete array of schema information

Parameters

string $schema Array of schema files or single schema file. Array of directories with schema files or single directory
string $format Format of the files we are parsing and building from

Return Value

array $array

void importSchema(string $schema, string $format = 'yml', string $directory = null, array $models = array())

importSchema

A method to import a Schema and translate it into a Doctrine_Record object

Parameters

string $schema The file containing the XML schema
string $format Format of the schema file
string $directory The directory where the Doctrine_Record class will be written
array $models Optional array of models to import

Return Value

void

array parseSchema(string $schema, string $type)

parseSchema

A method to parse a Schema and translate it into a property array. The function returns that property array.

Parameters

string $schema Path to the file containing the schema
string $type Format type of the schema we are parsing

Return Value

array $build Built array of schema information

protected void _processInheritance(string $array)

_processInheritance

Perform some processing on inheritance. Sets the default type and sets some default values for certain types

Parameters

string $array

Return Value

void

protected string _findBaseSuperClass($array, $class)

Find the base super class for this inheritance child. We need to move all levels of children to the top most parent.

Parameters

$array
$class

Return Value

string $class Class to get find the parent for

protected void _buildRelationships(string $array)

buildRelationships

Loop through an array of schema information and build all the necessary relationship information Will attempt to auto complete relationships and simplify the amount of information required for defining a relationship

Parameters

string $array

Return Value

void

protected void _autoCompleteOppositeRelations()

fixRelationships

Loop through all relationships building the opposite ends of each relationship and make sure no duplicate relations exist

Return Value

void

protected void _fixDuplicateRelations()

_fixDuplicateRelations

Ensure the relations for each class are unique and that no duplicated relations exist from the auto generated relations and the user explicitely defining the opposite end

Return Value

void

protected void _buildUniqueRelationKey(string $relation)

_buildUniqueRelationKey

Build a unique key to identify a relationship by Md5 hash of all the relationship parameters

Parameters

string $relation

Return Value

void

protected void _validateSchemaElement($name, $element, $path)

_validateSchemaElement

Parameters

$name
$element
$path

Return Value

void