PHP 클래스 Doctrine\DBAL\Migrations\Configuration\Configuration

부터: 2.0
저자: Jonathan H. Wage ([email protected])
파일 보기 프로젝트 열기: doctrine/migrations 1 사용 예제들

공개 메소드들

메소드 설명
__construct ( Doctrine\DBAL\Connection $connection, Doctrine\DBAL\Migrations\OutputWriter $outputWriter = null, Doctrine\DBAL\Migrations\Finder\MigrationFinderInterface $finder = null ) Construct a migration configuration object.
areMigrationsOrganizedByYear ( ) : boolean
areMigrationsOrganizedByYearAndMonth ( ) : boolean
createMigrationTable ( ) : boolean Create the migration table to track migrations with.
formatVersion ( string $version ) : string Returns a timestamp version as a formatted date
generateVersionNumber ( DateTimeInterface $now = null ) : string Generate a new migration version. A version is (usually) a datetime string.
getAvailableVersions ( ) : array Returns an array of available migration version numbers.
getConnection ( ) : Doctrine\DBAL\Connection Returns the Connection instance
getCurrentVersion ( ) : string Returns the current migrated version from the versions table.
getDateTime ( $version ) : string Returns the datetime of a migration
getLatestVersion ( ) : string Returns the latest available migration version.
getMigratedVersions ( ) : Version[] Returns all migrated versions from the versions table, in an array.
getMigrations ( ) : Version[] Get the array of registered migration versions.
getMigrationsColumnName ( ) : string Returns the migration column name
getMigrationsDirectory ( ) : string Returns the new migrations directory where new migration classes are generated
getMigrationsNamespace ( ) : string Returns the migrations namespace
getMigrationsTableName ( ) : string Returns the migration table name
getMigrationsToExecute ( string $direction, string $to ) : Version[] Returns the array of migrations to executed based on the given direction and target version number.
getName ( ) : string Returns the name of this set of migrations
getNextVersion ( ) : string | null Returns the version following the current version.
getNumberOfAvailableMigrations ( ) : integer Returns the total number of available migration versions
getNumberOfExecutedMigrations ( ) : integer Returns the total number of executed migration versions
getOutputWriter ( ) : Doctrine\DBAL\Migrations\OutputWriter Returns the OutputWriter instance
getPrevVersion ( ) : string | null Returns the version prior to the current version.
getRelativeVersion ( $version, $delta ) : string | null Returns the version with the specified offset to the specified version.
getVersion ( string $version ) : Version Returns the Version instance for a given version in the format YYYYMMDDHHMMSS.
hasVersion ( string $version ) : boolean Check if a version exists.
hasVersionMigrated ( Version $version ) : boolean Check if a version has been migrated or not yet
registerMigration ( string $version, string $class ) : Version Register a single migration version to be executed by a AbstractMigration class.
registerMigrations ( array $migrations ) : Version[] Register an array of migrations. Each key of the array is the version and the value is the migration class name.
registerMigrationsFromDirectory ( string $path ) : Version[] Register migrations from a given directory. Recursively finds all files with the pattern VersionYYYYMMDDHHMMSS.php as the filename and registers them as migrations.
resolveVersionAlias ( $alias ) : string | null Returns the version number from an alias.
setMigrationsAreOrganizedByYear ( boolean $migrationsAreOrganizedByYear = true )
setMigrationsAreOrganizedByYearAndMonth ( boolean $migrationsAreOrganizedByYearAndMonth = true )
setMigrationsColumnName ( string $columnName ) Set the migration column name
setMigrationsDirectory ( string $migrationsDirectory ) Set the new migrations directory where new migration classes are generated
setMigrationsFinder ( Doctrine\DBAL\Migrations\Finder\MigrationFinderInterface $finder ) Set the implementation of the migration finder.
setMigrationsNamespace ( string $migrationsNamespace ) Set the migrations namespace
setMigrationsTableName ( string $tableName ) Set the migration table name
setName ( string $name ) Set the name of this set of migrations
setOutputWriter ( Doctrine\DBAL\Migrations\OutputWriter $outputWriter ) Sets the output writer.
validate ( ) Validation that this instance has all the required properties configured

보호된 메소드들

메소드 설명
connect ( ) : boolean Explicitely opens the database connection. This is done to play nice with DBAL's MasterSlaveConnection. Which, in some cases, connects to a follower when fetching the executed migrations. If a follower is lagging significantly behind that means the migrations system may see unexecuted migrations that were actually executed earlier.
findMigrations ( string $path ) : array Find all the migrations in a given directory.

비공개 메소드들

메소드 설명
ensureMigrationClassExists ( string $class )
ensureOrganizeMigrationsIsCompatibleWithFinder ( )
shouldExecuteMigration ( string $direction, Version $version, string $to, array $migrated ) : boolean Check if we should execute a migration for a given direction and target migration version.

메소드 상세

__construct() 공개 메소드

Construct a migration configuration object.
public __construct ( Doctrine\DBAL\Connection $connection, Doctrine\DBAL\Migrations\OutputWriter $outputWriter = null, Doctrine\DBAL\Migrations\Finder\MigrationFinderInterface $finder = null )
$connection Doctrine\DBAL\Connection A Connection instance
$outputWriter Doctrine\DBAL\Migrations\OutputWriter A OutputWriter instance
$finder Doctrine\DBAL\Migrations\Finder\MigrationFinderInterface Migration files finder

areMigrationsOrganizedByYear() 공개 메소드

areMigrationsOrganizedByYearAndMonth() 공개 메소드

connect() 보호된 메소드

Explicitely opens the database connection. This is done to play nice with DBAL's MasterSlaveConnection. Which, in some cases, connects to a follower when fetching the executed migrations. If a follower is lagging significantly behind that means the migrations system may see unexecuted migrations that were actually executed earlier.
protected connect ( ) : boolean
리턴 boolean The same value returned from the `connect` method

createMigrationTable() 공개 메소드

Create the migration table to track migrations with.
public createMigrationTable ( ) : boolean
리턴 boolean Whether or not the table was created.

findMigrations() 보호된 메소드

Find all the migrations in a given directory.
protected findMigrations ( string $path ) : array
$path string the directory to search.
리턴 array

formatVersion() 공개 메소드

Returns a timestamp version as a formatted date
사용 중단:
public formatVersion ( string $version ) : string
$version string
리턴 string The formatted version

generateVersionNumber() 공개 메소드

Generate a new migration version. A version is (usually) a datetime string.
public generateVersionNumber ( DateTimeInterface $now = null ) : string
$now DateTimeInterface Defaults to the current time in UTC
리턴 string The newly generated version

getAvailableVersions() 공개 메소드

Returns an array of available migration version numbers.
public getAvailableVersions ( ) : array
리턴 array

getConnection() 공개 메소드

Returns the Connection instance
public getConnection ( ) : Doctrine\DBAL\Connection
리턴 Doctrine\DBAL\Connection $connection The Connection instance

getCurrentVersion() 공개 메소드

Returns the current migrated version from the versions table.
public getCurrentVersion ( ) : string
리턴 string

getDateTime() 공개 메소드

Returns the datetime of a migration
public getDateTime ( $version ) : string
$version
리턴 string

getLatestVersion() 공개 메소드

Returns the latest available migration version.
public getLatestVersion ( ) : string
리턴 string The version string in the format YYYYMMDDHHMMSS.

getMigratedVersions() 공개 메소드

Returns all migrated versions from the versions table, in an array.
public getMigratedVersions ( ) : Version[]
리턴 Doctrine\DBAL\Migrations\Version[]

getMigrations() 공개 메소드

Get the array of registered migration versions.
public getMigrations ( ) : Version[]
리턴 Doctrine\DBAL\Migrations\Version[] $migrations

getMigrationsColumnName() 공개 메소드

Returns the migration column name
public getMigrationsColumnName ( ) : string
리턴 string $migrationsColumnName The migration column name

getMigrationsDirectory() 공개 메소드

Returns the new migrations directory where new migration classes are generated
public getMigrationsDirectory ( ) : string
리턴 string $migrationsDirectory The new migrations directory

getMigrationsNamespace() 공개 메소드

Returns the migrations namespace
public getMigrationsNamespace ( ) : string
리턴 string $migrationsNamespace The migrations namespace

getMigrationsTableName() 공개 메소드

Returns the migration table name
public getMigrationsTableName ( ) : string
리턴 string $migrationsTableName The migration table name

getMigrationsToExecute() 공개 메소드

Returns the array of migrations to executed based on the given direction and target version number.
public getMigrationsToExecute ( string $direction, string $to ) : Version[]
$direction string The direction we are migrating.
$to string The version to migrate to.
리턴 Doctrine\DBAL\Migrations\Version[] $migrations The array of migrations we can execute.

getName() 공개 메소드

Returns the name of this set of migrations
public getName ( ) : string
리턴 string $name The name of this set of migrations

getNextVersion() 공개 메소드

Returns the version following the current version.
public getNextVersion ( ) : string | null
리턴 string | null A version string, or null if the current version is the latest.

getNumberOfAvailableMigrations() 공개 메소드

Returns the total number of available migration versions

getNumberOfExecutedMigrations() 공개 메소드

Returns the total number of executed migration versions

getOutputWriter() 공개 메소드

Returns the OutputWriter instance
public getOutputWriter ( ) : Doctrine\DBAL\Migrations\OutputWriter
리턴 Doctrine\DBAL\Migrations\OutputWriter $outputWriter The OutputWriter instance

getPrevVersion() 공개 메소드

Returns the version prior to the current version.
public getPrevVersion ( ) : string | null
리턴 string | null A version string, or null if the current version is the first.

getRelativeVersion() 공개 메소드

Returns the version with the specified offset to the specified version.
public getRelativeVersion ( $version, $delta ) : string | null
리턴 string | null A version string, or null if the specified version is unknown or the specified delta is not within the list of available versions.

getVersion() 공개 메소드

Returns the Version instance for a given version in the format YYYYMMDDHHMMSS.
public getVersion ( string $version ) : Version
$version string The version string in the format YYYYMMDDHHMMSS.
리턴 Doctrine\DBAL\Migrations\Version

hasVersion() 공개 메소드

Check if a version exists.
public hasVersion ( string $version ) : boolean
$version string
리턴 boolean

hasVersionMigrated() 공개 메소드

Check if a version has been migrated or not yet
public hasVersionMigrated ( Version $version ) : boolean
$version Doctrine\DBAL\Migrations\Version
리턴 boolean

registerMigration() 공개 메소드

Register a single migration version to be executed by a AbstractMigration class.
public registerMigration ( string $version, string $class ) : Version
$version string The version of the migration in the format YYYYMMDDHHMMSS.
$class string The migration class to execute for the version.
리턴 Doctrine\DBAL\Migrations\Version

registerMigrations() 공개 메소드

Register an array of migrations. Each key of the array is the version and the value is the migration class name.
public registerMigrations ( array $migrations ) : Version[]
$migrations array
리턴 Doctrine\DBAL\Migrations\Version[]

registerMigrationsFromDirectory() 공개 메소드

Register migrations from a given directory. Recursively finds all files with the pattern VersionYYYYMMDDHHMMSS.php as the filename and registers them as migrations.
public registerMigrationsFromDirectory ( string $path ) : Version[]
$path string The root directory to where some migration classes live.
리턴 Doctrine\DBAL\Migrations\Version[] The array of migrations registered.

resolveVersionAlias() 공개 메소드

Supported aliases are: - first: The very first version before any migrations have been run. - current: The current version. - prev: The version prior to the current version. - next: The version following the current version. - latest: The latest available version. If an existing version number is specified, it is returned verbatimly.
public resolveVersionAlias ( $alias ) : string | null
리턴 string | null A version number, or null if the specified alias does not map to an existing version, e.g. if "next" is passed but the current version is already the latest.

setMigrationsAreOrganizedByYear() 공개 메소드

public setMigrationsAreOrganizedByYear ( boolean $migrationsAreOrganizedByYear = true )
$migrationsAreOrganizedByYear boolean

setMigrationsAreOrganizedByYearAndMonth() 공개 메소드

public setMigrationsAreOrganizedByYearAndMonth ( boolean $migrationsAreOrganizedByYearAndMonth = true )
$migrationsAreOrganizedByYearAndMonth boolean

setMigrationsColumnName() 공개 메소드

Set the migration column name
public setMigrationsColumnName ( string $columnName )
$columnName string The migration column name

setMigrationsDirectory() 공개 메소드

Set the new migrations directory where new migration classes are generated
public setMigrationsDirectory ( string $migrationsDirectory )
$migrationsDirectory string The new migrations directory

setMigrationsFinder() 공개 메소드

Set the implementation of the migration finder.
public setMigrationsFinder ( Doctrine\DBAL\Migrations\Finder\MigrationFinderInterface $finder )
$finder Doctrine\DBAL\Migrations\Finder\MigrationFinderInterface The new migration finder

setMigrationsNamespace() 공개 메소드

Set the migrations namespace
public setMigrationsNamespace ( string $migrationsNamespace )
$migrationsNamespace string The migrations namespace

setMigrationsTableName() 공개 메소드

Set the migration table name
public setMigrationsTableName ( string $tableName )
$tableName string The migration table name

setName() 공개 메소드

Set the name of this set of migrations
public setName ( string $name )
$name string The name of this set of migrations

setOutputWriter() 공개 메소드

Sets the output writer.
public setOutputWriter ( Doctrine\DBAL\Migrations\OutputWriter $outputWriter )
$outputWriter Doctrine\DBAL\Migrations\OutputWriter

validate() 공개 메소드

Validation that this instance has all the required properties configured
public validate ( )