Neos\Flow\Core\Migrations\Manager::commitMigration PHP Method

commitMigration() protected method

Commit changes done to the package described by $packageData. The migration that was did the changes is given with $versionNumber and $versionPackageKey and will be recorded in the commit message.
protected commitMigration ( AbstractMigration $migration, string $commitMessageNotice = null ) : string
$migration AbstractMigration
$commitMessageNotice string
return string
    protected function commitMigration(AbstractMigration $migration, $commitMessageNotice = null)
    {
        $migrationIdentifier = $migration->getIdentifier();
        $commitMessageSubject = sprintf('TASK: Apply migration %s', $migrationIdentifier);
        if (!Git::isWorkingCopyRoot($this->currentPackageData['path'])) {
            $commitMessageSubject .= sprintf(' to package "%s"', $this->currentPackageData['packageKey']);
        }
        $commitMessage = $commitMessageSubject . chr(10) . chr(10);
        $description = $migration->getDescription();
        if ($description !== null) {
            $commitMessage .= wordwrap($description, 72);
        } else {
            $commitMessage .= wordwrap(sprintf('This commit contains the result of applying migration %s to this package.', $migrationIdentifier), 72);
        }
        if ($commitMessageNotice !== null) {
            $commitMessage .= chr(10) . chr(10) . wordwrap($commitMessageNotice, 72) . chr(10) . chr(10);
        }
        list($returnCode, $output) = Git::commitAll($this->currentPackageData['path'], $commitMessage);
        if ($returnCode === 0) {
            return '    ' . implode(PHP_EOL . '    ', $output) . PHP_EOL;
        } else {
            return '    No changes were committed.' . PHP_EOL;
        }
    }