Stud.IP  jlu_4.3 Revision 64286
Migrator Class Reference
Collaboration diagram for Migrator:
Collaboration graph

Public Member Functions

 __construct ($migrations_path, SchemaVersion $version, $verbose=false)
 
 migrate_to ($target_version)
 
 relevant_migrations ($target_version)
 
 migration_classes ()
 
 top_version ()
 

Protected Member Functions

 migration_class ($migration)
 
 migration_files ()
 
 migration_version_and_name ($migration_file)
 
 log ($format)
 

Constructor & Destructor Documentation

◆ __construct()

__construct (   $migrations_path,
SchemaVersion  $version,
  $verbose = false 
)

Constructor.

Parameters
stringa file path to the directory containing the migration files
SchemaVersionthe current schema version persistor
booleanverbose or not
Returns
void

Member Function Documentation

◆ log()

log (   $format)
protected

Overridable method used to return a textual representation of what's going on in me. You can use me as you would use printf.

Parameters
stringjust a dummy value, instead use this method as you would use printf & co.
Here is the caller graph for this function:

◆ migrate_to()

migrate_to (   $target_version)

Invoking this method will perform the migrations with an index between the current schema version (provided by the SchemaVersion object) and a target version calling the methods #up and #down in sequence.

Parameters
mixedthe target version as an integer or NULL thus migrating to the top migration
Here is the call graph for this function:

◆ migration_class()

migration_class (   $migration)
protected

Maps a file name to a class name.

Parameters
stringpart of the file name
Returns
string the derived class name
Here is the caller graph for this function:

◆ migration_classes()

migration_classes ( )

Returns the collection (an array) of all migrations in this migrator's path.

Returns
array an associative array, whose keys are the migration's version and whose values are arrays containing the migration's file and class name.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ migration_files()

migration_files ( )
protected

Return all migration file names from my migrations_path.

Returns
array a collection of file names
Here is the caller graph for this function:

◆ migration_version_and_name()

migration_version_and_name (   $migration_file)
protected

Split a migration file name into that migration's version and name.

Parameters
stringa file name
Returns
array an array of two elements containing the migration's version and name.
Here is the caller graph for this function:

◆ relevant_migrations()

relevant_migrations (   $target_version)

Invoking this method will return a list of migrations with an index between the current schema version (provided by the SchemaVersion object) and a target version calling the methods #up and #down in sequence.

Parameters
mixedthe target version as an integer or NULL thus migrating to the top migration
Returns
array an associative array, whose keys are the migration's version and whose values are the migration objects
Here is the call graph for this function:
Here is the caller graph for this function:

◆ top_version()

top_version ( )

Returns the top migration's version.

Returns
int the top migration's version.
Here is the call graph for this function:
Here is the caller graph for this function:

The documentation for this class was generated from the following file: