class Doctrine_Migration_Diff (View source)

Doctrine_Migration_Diff - class used for generating differences and migration classes from 'from' and 'to' schema information.

Properties

protected $_from
protected $_to
protected $_changes
protected $_migration
protected $_startingModelFiles
protected $_tmpPath
static protected $_toPrefix
static protected $_fromPrefix

Methods

void
__construct(string $from, string $to, mixed $migration)

Instantiate new Doctrine_Migration_Diff instance

void
setTmpPath(string $tmpPath)

Set the temporary path to store the generated models for generating diffs

string
getUniqueId()

Get unique hash id for this migration instance

array
generateChanges()

Generate an array of changes found between the from and to schema information.

array
generateMigrationClasses()

Generate a migration class for the changes in this diff instance

array
_initializeModels(string $path)

Initialize some Doctrine models at a given path.

array
_diff(string $from, string $to)

Generate a diff between the from and to schema information

array
_buildChanges(array $from, array $to)

Build array of changes between the from and to array of schema information

array
_buildModelInformation(array $models)

Build all the model schema information for the passed array of models

mixed
_cleanModelInformation(mixed $info)

Clean the produced model information of any potential prefix text

string
_getItemExtension(string $item)

Get the extension of the type of file contained in a directory.

string
_generateModels(string $prefix, mixed $item)

Generate a set of models for the schema information source

void
_cleanup()

Cleanup temporary generated models after a diff is performed

Details

void __construct(string $from, string $to, mixed $migration)

Instantiate new Doctrine_Migration_Diff instance

$diff = new Doctrine_Migration_Diff('/path/to/old_models', '/path/to/new_models', '/path/to/migrations'); $diff->generateMigrationClasses();

Parameters

string $from The from schema information source
string $to The to schema information source
mixed $migration Instance of Doctrine_Migration or path to migration classes

Return Value

void

void setTmpPath(string $tmpPath)

Set the temporary path to store the generated models for generating diffs

Parameters

string $tmpPath

Return Value

void

protected string getUniqueId()

Get unique hash id for this migration instance

Return Value

string $uniqueId

array generateChanges()

Generate an array of changes found between the from and to schema information.

Return Value

array $changes

array generateMigrationClasses()

Generate a migration class for the changes in this diff instance

Return Value

array $changes

protected array _initializeModels(string $path)

Initialize some Doctrine models at a given path.

Parameters

string $path

Return Value

array $models

protected array _diff(string $from, string $to)

Generate a diff between the from and to schema information

Parameters

string $from Path to set of models to migrate from
string $to Path to set of models to migrate to

Return Value

array $changes

protected array _buildChanges(array $from, array $to)

Build array of changes between the from and to array of schema information

Parameters

array $from Array of schema information to generate changes from
array $to Array of schema information to generate changes for

Return Value

array $changes

protected array _buildModelInformation(array $models)

Build all the model schema information for the passed array of models

Parameters

array $models Array of models to build the schema information for

Return Value

array $info Array of schema information for all the passed models

protected mixed _cleanModelInformation(mixed $info)

Clean the produced model information of any potential prefix text

Parameters

mixed $info Either array or string to clean of prefixes

Return Value

mixed $info Cleaned value which is either an array or string

protected string _getItemExtension(string $item)

Get the extension of the type of file contained in a directory.

Used to determine if a directory contains YAML or PHP files.

Parameters

string $item

Return Value

string $extension

protected string _generateModels(string $prefix, mixed $item)

Generate a set of models for the schema information source

Parameters

string $prefix Prefix to generate the models with
mixed $item The item to generate the models from

Return Value

string $path The path where the models were generated

Exceptions

Doctrine_Migration_Exception $e

protected void _cleanup()

Cleanup temporary generated models after a diff is performed

Return Value

void