Skip to main content

GravityKit\GravityMigrate\Migration\MigrationOutcome

Whether a run wrote everything, some of it, or nothing -- and which of its forms did.

One verdict over a report of many forms, which every surface needs and none should compute for itself: a CLI exit code is the only thing a script reads, so a run in which every form failed must not end on Success:, and an ability answering "did that work" has the same three answers to choose between. Partial is its own answer rather than either of the other two: some forms went across and some did not, and calling that a failure would send an operator looking for a migration that in fact happened.

The verdict and the list are one reading of the report, so they are one class: a surface that counted the forms that worked its own way could report a count that disagrees with the exit code it prints beside it.

Since: %ver%

Source: src/Migration/MigrationOutcome.php:26

Details

  • Kind: class
  • Namespace: GravityKit\GravityMigrate\Migration

Methods

MethodDescription
of()How this report ended.
worked()The entries for the forms that did what was asked of them.

Method Reference

of()

public static function of( array $report ): string

How this report ended.

Parameters

NameTypeDefaultDescription
$reportarrayOne entry per form, each carrying a status.

Returns

  • string — One of self::SUCCEEDED, self::PARTIAL or self::FAILED.

Since: %ver%

Source: src/Migration/MigrationOutcome.php:67

worked()

public static function worked( array $report ): array

The entries for the forms that did what was asked of them.

What a machine-readable format answers about, because a report carries every form that was ASKED about and a script reads the answer as a list of forms it can now use. A form whose check failed has no answer to hand back -- there is no new form, and the dry run learned nothing about the one that was named -- and a partial run exits 0, so an id printed for it reaches the script as a success.

Parameters

NameTypeDefaultDescription
$reportarrayOne entry per form, each carrying a status.

Returns

  • array<int, — array> The entries that worked, in report order.

Since: %ver%

Source: src/Migration/MigrationOutcome.php:96