class Doctrine_Migration_Builder extends Doctrine_Builder (View source)

Doctrine_Migration_Builder

Methods

void
varExport(string $var)

Special function for var_export() The normal code which is returned is malformed and does not follow Doctrine standards So we do some string replacing to clean it up

void
__construct($migrationsPath = null)

Instantiate new instance of the Doctrine_Migration_Builder class

void
setMigrationsPath(string $path)

Set the path to write the generated migration classes

string
getMigrationsPath()

Get the path where generated migration classes are written to

void
loadTemplate()

Loads the class template used for generating classes

array
generateMigrationsFromDiff(Doctrine_Migration_Diff $diff)

Generate migrations from a Doctrine_Migration_Diff instance

void
generateMigrationsFromDb()

Generate a set of migration classes from the existing databases

boolean
generateMigrationsFromModels(string $modelsPath = null, string $modelLoading = null)

Generate a set of migrations from a set of models

string
buildCreateForeignKey(string $tableName, array $definition)

Build the code for creating foreign keys

string
buildDropForeignKey(string $tableName, array $definition)

Build the code for dropping foreign keys

string
buildCreateTable(string $tableData)

Build the code for creating tables

string
buildDropTable(string $tableData)

Build the code for dropping tables

string
buildAddColumn(string $tableName, string $columnName, string $column)

Build the code for adding columns

string
buildRemoveColumn(string $tableName, string $columnName, string $column)

Build the code for removing columns

string
buildChangeColumn(string $tableName, string $columnName, string $column)

Build the code for changing columns

sgtring
buildAddIndex(string $tableName, string $indexName, string $index)

Build the code for adding indexes

string
buildRemoveIndex(string $tableName, string $indexName, string $index)

Build the code for removing indexes

mixed
generateMigrationClass(string $className, array $options = array(), string $up = null, string $down = null, boolean $return = false)

Generate a migration class

string
buildMigrationClass(string $className, string $fileName = null, array $options = array(), string $up = null, string $down = null)

Build the code for a migration class

Details

void varExport(string $var)

Special function for var_export() The normal code which is returned is malformed and does not follow Doctrine standards So we do some string replacing to clean it up

Parameters

string $var

Return Value

void

void __construct($migrationsPath = null)

Instantiate new instance of the Doctrine_Migration_Builder class

$builder = new Doctrine_Migration_Builder('/path/to/migrations');

Parameters

$migrationsPath

Return Value

void

void setMigrationsPath(string $path)

Set the path to write the generated migration classes

Parameters

string $path path the path where migration classes are stored and being generated

Return Value

void

string getMigrationsPath()

Get the path where generated migration classes are written to

Return Value

string the path where migration classes are stored and being generated

protected void loadTemplate()

Loads the class template used for generating classes

Return Value

void

array generateMigrationsFromDiff(Doctrine_Migration_Diff $diff)

Generate migrations from a Doctrine_Migration_Diff instance

Parameters

Doctrine_Migration_Diff $diff Instance to generate changes from

Return Value

array $changes Array of changes produced from the diff

void generateMigrationsFromDb()

Generate a set of migration classes from the existing databases

Return Value

void

boolean generateMigrationsFromModels(string $modelsPath = null, string $modelLoading = null)

Generate a set of migrations from a set of models

Parameters

string $modelsPath Path to models
string $modelLoading What type of model loading to use when loading the models

Return Value

boolean

string buildCreateForeignKey(string $tableName, array $definition)

Build the code for creating foreign keys

Parameters

string $tableName
array $definition

Return Value

string $code

string buildDropForeignKey(string $tableName, array $definition)

Build the code for dropping foreign keys

Parameters

string $tableName
array $definition

Return Value

string $code

string buildCreateTable(string $tableData)

Build the code for creating tables

Parameters

string $tableData

Return Value

string $code

string buildDropTable(string $tableData)

Build the code for dropping tables

Parameters

string $tableData

Return Value

string $code

string buildAddColumn(string $tableName, string $columnName, string $column)

Build the code for adding columns

Parameters

string $tableName
string $columnName
string $column

Return Value

string $code

string buildRemoveColumn(string $tableName, string $columnName, string $column)

Build the code for removing columns

Parameters

string $tableName
string $columnName
string $column

Return Value

string $code

string buildChangeColumn(string $tableName, string $columnName, string $column)

Build the code for changing columns

Parameters

string $tableName
string $columnName
string $column

Return Value

string $code

sgtring buildAddIndex(string $tableName, string $indexName, string $index)

Build the code for adding indexes

Parameters

string $tableName
string $indexName
string $index

Return Value

sgtring $code

string buildRemoveIndex(string $tableName, string $indexName, string $index)

Build the code for removing indexes

Parameters

string $tableName
string $indexName
string $index

Return Value

string $code

mixed generateMigrationClass(string $className, array $options = array(), string $up = null, string $down = null, boolean $return = false)

Generate a migration class

Parameters

string $className Class name to generate
array $options Options for the migration class
string $up The code for the up function
string $down The code for the down function
boolean $return Whether or not to return the code. If true return and false it writes the class to disk.

Return Value

mixed

string buildMigrationClass(string $className, string $fileName = null, array $options = array(), string $up = null, string $down = null)

Build the code for a migration class

Parameters

string $className Class name to generate
string $fileName File name to write the class to
array $options Options for the migration class
string $up The code for the up function
string $down The code for the down function

Return Value

string $content The code for the generated class