thrownewDoctrine_Migration_Exception('Could not find migration class for migration step: '.$num);
}
publicfunctiondoMigrateStep($direction,$num)
/**
* doMigrateStep
*
* Perform migration directory for the specified version. Loads migration classes and performs the migration then processes the changes
*
* @param string $direction
* @param string $num
* @return void
*/
protectedfunctiondoMigrateStep($direction,$num)
{
$migrate=$this->getMigrationClass($num);
$migrate->doMigrate($direction);
}
publicfunctiondoMigrate($direction)
/**
* doMigrate
*
* Perform migration for a migration class. Executes the up or down method then processes the changes
*
* @param string $direction
* @return void
*/
protectedfunctiondoMigrate($direction)
{
if(method_exists($this,$direction)){
$this->$direction();
$this->processChanges();
foreach($this->changesas$type=>$changes){
$process=newDoctrine_Migration_Process();
$funcName='process'.Doctrine::classify($type);
if(!empty($changes)){
$process->$funcName($changes);
}
}
}
}
publicfunctionprocessChanges()
/**
* migrate
*
* Perform a migration chain by specifying the $from and $to.
* If you do not specify a $from or $to then it will attempt to migrate from the current version to the latest version
*
* @param string $from
* @param string $to
* @return void
*/
publicfunctionmigrate($from=null,$to=null)
{
foreach($this->changesas$type=>$changes){
$process=newDoctrine_Migration_Process();
$funcName='process'.Doctrine::classify($type);
$process->$funcName($changes);
// If nothing specified then lets assume we are migrating from the current version to the latest version
if($from===null&&$to===null){
$from=$this->getCurrentVersion();
$to=$this->getLatestVersion();
}
if($from===$to){
thrownewDoctrine_Migration_Exception('You specified an invalid migration path. The from and to cannot be the same. You specified from: '.$from.' and to: '.$to);