PHP Class Neos\Flow\Core\Migrations\AbstractMigration

显示文件 Open project: neos/flow-development-collection Class Usage Examples

Protected Properties

Property Type Description
$migrationsManager Manager
$notes array
$operations array
$sourcePackageKey string
$targetPackageData array
$warnings array

Public Methods

Method Description
__construct ( Manager $manager, string $packageKey )
execute ( ) : void
getDescription ( ) : string Returns the first line of the migration class doc comment
getIdentifier ( ) : string Returns the identifier of this migration, e.g. 'Neos.Flow-20120126163610'.
getNotes ( ) : array
getSourcePackageKey ( ) : string Returns the package key this migration comes from.
getVersionNumber ( ) : string Returns the version of this migration, e.g. '20120126163610'.
getWarnings ( ) : array
hasNotes ( ) : boolean
hasWarnings ( ) : boolean
prepare ( array $targetPackageData ) : void Resets internal state and sets the target package data.
up ( ) : void Anything that needs to be done in the migration when migrating into the "up" direction needs to go into this method.

Protected Methods

Method Description
applyFileOperations ( ) : void Applies all registered moveFile operations.
applySearchAndReplaceOperations ( ) : void Applies all registered searchAndReplace operations.
deleteFile ( string $pathAndFileName ) : void Delete a file.
moveFile ( string $oldPath, string $newPath ) : void Move a file (or directory) from $oldPath to $newPath.
moveSettingsPaths ( string $sourcePath, string $destinationPath ) Move a settings path from "source" to "destination"; best to be used when package names change.
processConfiguration ( string $configurationType, Closure $processor, boolean $saveResult = false ) : void Apply the given processor to the raw results of loading the given configuration type for the package from YAML. If multiple files exist (context configuration) all are processed independently.
renameClass ( string $oldName, string $newName ) : void Rename a class from $oldName to $newName.
renameMethod ( string $className, string $oldMethodName, string $newMethodName, boolean $withInheritance = true ) : void Rename a class method.
searchAndReplace ( string $search, string $replacement, array | string $filter = ['php', 'yaml', 'html'] ) : void Does a simple search and replace on all (textual) files. The filter array can be used to give file extensions to limit the operation to.
searchAndReplaceRegex ( string $search, string | Closure $replacement, array | string $filter = ['php', 'yaml', 'html'] ) : void Does a regex search and replace on all (textual) files. The filter array can be used to give file extensions to limit the operation to.
showNote ( string $note ) : void This can be used to show a note to the developer.
showWarning ( string $warning ) : void This can be used to show a warning to the developer.

Method Details

__construct() public method

public __construct ( Manager $manager, string $packageKey )
$manager Manager
$packageKey string

applyFileOperations() protected method

Applies all registered moveFile operations.
protected applyFileOperations ( ) : void
return void

applySearchAndReplaceOperations() protected method

Applies all registered searchAndReplace operations.
protected applySearchAndReplaceOperations ( ) : void
return void

deleteFile() protected method

Delete a file.
protected deleteFile ( string $pathAndFileName ) : void
$pathAndFileName string
return void

execute() public method

public execute ( ) : void
return void

getDescription() public method

Returns the first line of the migration class doc comment
public getDescription ( ) : string
return string

getIdentifier() abstract public method

Returns the identifier of this migration, e.g. 'Neos.Flow-20120126163610'.
abstract public getIdentifier ( ) : string
return string

getNotes() public method

public getNotes ( ) : array
return array

getSourcePackageKey() public method

Returns the package key this migration comes from.
public getSourcePackageKey ( ) : string
return string

getVersionNumber() public method

Returns the version of this migration, e.g. '20120126163610'.
public getVersionNumber ( ) : string
return string

getWarnings() public method

public getWarnings ( ) : array
return array

hasNotes() public method

public hasNotes ( ) : boolean
return boolean

hasWarnings() public method

public hasWarnings ( ) : boolean
return boolean

moveFile() protected method

If $oldPath ends with a * everything starting with $oldPath will be moved into $newPath (which then is created as a directory, if it does not yet exist).
protected moveFile ( string $oldPath, string $newPath ) : void
$oldPath string
$newPath string
return void

moveSettingsPaths() protected method

Move a settings path from "source" to "destination"; best to be used when package names change.
protected moveSettingsPaths ( string $sourcePath, string $destinationPath )
$sourcePath string
$destinationPath string

prepare() public method

Resets internal state and sets the target package data.
public prepare ( array $targetPackageData ) : void
$targetPackageData array
return void

processConfiguration() protected method

Apply the given processor to the raw results of loading the given configuration type for the package from YAML. If multiple files exist (context configuration) all are processed independently.
protected processConfiguration ( string $configurationType, Closure $processor, boolean $saveResult = false ) : void
$configurationType string One of ConfigurationManager::CONFIGURATION_TYPE_*
$processor Closure
$saveResult boolean
return void

renameClass() protected method

This expects fully qualified class names, so proper refactoring can be done.
protected renameClass ( string $oldName, string $newName ) : void
$oldName string
$newName string
return void

renameMethod() protected method

This expects a fully qualified class name, so proper refactoring can be done.
protected renameMethod ( string $className, string $oldMethodName, string $newMethodName, boolean $withInheritance = true ) : void
$className string the class that contains the method to be renamed
$oldMethodName string the method to be renamed
$newMethodName string the new method name
$withInheritance boolean if true, also rename method on child classes
return void

searchAndReplace() protected method

Does a simple search and replace on all (textual) files. The filter array can be used to give file extensions to limit the operation to.
protected searchAndReplace ( string $search, string $replacement, array | string $filter = ['php', 'yaml', 'html'] ) : void
$search string
$replacement string
$filter array | string either an array with file extensions to consider or the full path to a single file to process
return void

searchAndReplaceRegex() protected method

The patterns are used as is, no quoting is done. A closure can be given for the $replacement variable. It should return a string and is given an array of matches as parameter.
protected searchAndReplaceRegex ( string $search, string | Closure $replacement, array | string $filter = ['php', 'yaml', 'html'] ) : void
$search string
$replacement string | Closure
$filter array | string either an array with file extensions to consider or the full path to a single file to process
return void

showNote() protected method

If changes cannot be automated or something needs to be adjusted manually for other reasons, leave a note for the developer. The notes will be shown together after migrations have been run.
See also: showWarning
protected showNote ( string $note ) : void
$note string
return void

showWarning() protected method

Similar to showNote, but the output is given a stronger emphasis. The warnings will be shown together after migrations have been run.
See also: showNote
protected showWarning ( string $warning ) : void
$warning string
return void

up() abstract public method

It will be called by the Manager upon migration.
abstract public up ( ) : void
return void

Property Details

$migrationsManager protected_oe property

protected Manager,Neos\Flow\Core\Migrations $migrationsManager
return Manager

$notes protected_oe property

protected array $notes
return array

$operations protected_oe property

protected array $operations
return array

$sourcePackageKey protected_oe property

protected string $sourcePackageKey
return string

$targetPackageData protected_oe property

protected array $targetPackageData
return array

$warnings protected_oe property

protected array $warnings
return array