PHP Class Neos\Flow\Core\Migrations\AbstractMigration

Afficher le fichier Open project: neos/flow-development-collection Class Usage Examples

Protected Properties

Свойство Type Description
$migrationsManager Manager
$notes array
$operations array
$sourcePackageKey string
$targetPackageData array
$warnings array

Méthodes publiques

Méthode 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.

Méthodes protégées

Méthode 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 méthode

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

applyFileOperations() protected méthode

Applies all registered moveFile operations.
protected applyFileOperations ( ) : void
Résultat void

applySearchAndReplaceOperations() protected méthode

Applies all registered searchAndReplace operations.
protected applySearchAndReplaceOperations ( ) : void
Résultat void

deleteFile() protected méthode

Delete a file.
protected deleteFile ( string $pathAndFileName ) : void
$pathAndFileName string
Résultat void

execute() public méthode

public execute ( ) : void
Résultat void

getDescription() public méthode

Returns the first line of the migration class doc comment
public getDescription ( ) : string
Résultat string

getIdentifier() abstract public méthode

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

getNotes() public méthode

public getNotes ( ) : array
Résultat array

getSourcePackageKey() public méthode

Returns the package key this migration comes from.
public getSourcePackageKey ( ) : string
Résultat string

getVersionNumber() public méthode

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

getWarnings() public méthode

public getWarnings ( ) : array
Résultat array

hasNotes() public méthode

public hasNotes ( ) : boolean
Résultat boolean

hasWarnings() public méthode

public hasWarnings ( ) : boolean
Résultat boolean

moveFile() protected méthode

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
Résultat void

moveSettingsPaths() protected méthode

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 méthode

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

processConfiguration() protected méthode

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
Résultat void

renameClass() protected méthode

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

renameMethod() protected méthode

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
Résultat void

searchAndReplace() protected méthode

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
Résultat void

searchAndReplaceRegex() protected méthode

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
Résultat void

showNote() protected méthode

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
Résultat void

showWarning() protected méthode

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
Résultat void

up() abstract public méthode

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

Property Details

$migrationsManager protected_oe property

protected Manager,Neos\Flow\Core\Migrations $migrationsManager
Résultat Manager

$notes protected_oe property

protected array $notes
Résultat array

$operations protected_oe property

protected array $operations
Résultat array

$sourcePackageKey protected_oe property

protected string $sourcePackageKey
Résultat string

$targetPackageData protected_oe property

protected array $targetPackageData
Résultat array

$warnings protected_oe property

protected array $warnings
Résultat array