GravityKit\GravityMigrate\Schema\TransformationLog
Tracks the transformation history of forms and fields.
Each record says what changed, how severely, and what the value was before, so a migration can
report what it dropped and a later one can tell it is bringing a form back where it started.
Logs chain through previous, and the length of that chain is the number of trips a form has
made.
Since: %ver%
Source: src/Schema/TransformationLog.php:20
Details
-
Kind:
class -
Namespace:
GravityKit\GravityMigrate\Schema -
Implements:
JsonSerializable
Properties
| Property | Type | Description |
|---|---|---|
$source_platform | string | Source platform identifier. |
$source_id | string | int | Source identifier (form ID, field ID, etc.). |
$target_platform | string | Target platform identifier. |
$target_id | string | int | Target identifier. |
$transformations | array<array> | Transformation records. |
$created_at | int | Timestamp of creation. |
$previous | TransformationLog | null | Previous transformation log in chain (for round-trips). |
Methods
| Method | Description |
|---|---|
__construct() | Constructor. |
record() | Records a transformation. |
record_field_type_change() | Records a field type transformation. |
record_property_change() | Records a property transformation. |
record_smart_tag_change() | Records a smart tag transformation. |
record_composite_operation() | Records a composite field operation. |
record_data_loss() | Records a lossy transformation with warning. |
get_transformations() | Gets all transformations. |
get_transformations_by_category() | Gets transformations by category. |
get_transformations_by_severity() | Gets transformations by severity. |
has_data_loss() | Checks if any lossy transformations occurred. |
get_data_loss_summary() | Gets a summary of data loss. |
set_source() | Sets the source information. |
set_target() | Sets the target information. |
get_source_platform() | Gets source platform. |
get_source_id() | Gets source ID. |
get_target_platform() | Gets target platform. |
get_target_id() | Gets target ID. |
link_previous() | Links to a previous transformation log (for round-trips). |
get_previous() | Gets the previous transformation log. |
is_round_trip() | Checks if this is part of a round-trip. |
get_round_trip_depth() | Gets the round-trip depth. |
from_array() | Creates from array. |
to_array() | Converts to array. |
Method Reference
__construct()
public function __construct( string $source_platform='', $source_id='', string $target_platform='', $target_id='' )
Constructor.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$source_platform | string | '' | Source platform. |
$source_id | string | int | '' | Source identifier. |
$target_platform | string | '' | Target platform. |
$target_id | string | int | '' | Target identifier. |
Since: %ver%
Source: src/Schema/TransformationLog.php:124
record()
public function record( string $type, string $category, string $severity, string $description, array $original_data=[], array $result_data=[], array $metadata=[] ): self
Records a transformation.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$type | string | Transformation type. | |
$category | string | Transformation category. | |
$severity | string | Severity level. | |
$description | string | Human-readable description. | |
$original_data | array | [] | Original data before transformation. |
$result_data | array | [] | Resulting data after transformation. |
$metadata | array | [] | Additional metadata. |
Returns
self
Since: %ver%
Source: src/Schema/TransformationLog.php:152
record_field_type_change()
public function record_field_type_change( string $source_type, string $target_type, string $severity=self::SEVERITY_LOSSLESS, array $metadata=[] ): self
Records a field type transformation.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$source_type | string | Source field type. | |
$target_type | string | Target field type. | |
$severity | string | self::SEVERITY_LOSSLESS | Severity level. |
$metadata | array | [] | Additional metadata. |
Returns
self
Since: %ver%
Source: src/Schema/TransformationLog.php:187
record_property_change()
public function record_property_change( string $property, $original, $result, string $severity=self::SEVERITY_LOSSLESS, array $metadata=[] ): self
Records a property transformation.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$property | string | Property name. | |
$original | mixed | Original value. | |
$result | mixed | Result value. | |
$severity | string | self::SEVERITY_LOSSLESS | Severity level. |
$metadata | array | [] | Additional metadata. |
Returns
self
Since: %ver%
Source: src/Schema/TransformationLog.php:217
record_smart_tag_change()
public function record_smart_tag_change( string $original, string $result, array $metadata=[] ): self
Records a smart tag transformation.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$original | string | Original tag. | |
$result | string | Result tag. | |
$metadata | array | [] | Additional metadata. |
Returns
self
Since: %ver%
Source: src/Schema/TransformationLog.php:246
record_composite_operation()
public function record_composite_operation( string $operation, array $source_ids, $target_id, array $metadata=[] ): self
Records a composite field operation.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$operation | string | Operation type (recompose, decompose). | |
$source_ids | array | Source field IDs. | |
$target_id | mixed | Target field ID. | |
$metadata | array | [] | Additional metadata. |
Returns
self
Since: %ver%
Source: src/Schema/TransformationLog.php:274
record_data_loss()
public function record_data_loss( string $category, string $description, array $lost_data, array $metadata=[] ): self
Records a lossy transformation with warning.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$category | string | Category. | |
$description | string | Description. | |
$lost_data | array | Data that was lost. | |
$metadata | array | [] | Additional metadata. |
Returns
self
Since: %ver%
Source: src/Schema/TransformationLog.php:307
get_transformations()
public function get_transformations(): array
Gets all transformations.
Returns
array
Since: %ver%
Source: src/Schema/TransformationLog.php:331
get_transformations_by_category()
public function get_transformations_by_category( string $category ): array
Gets transformations by category.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$category | string | Category to filter by. |
Returns
array— The matching records, keeping their original keys rather than renumbered.
Since: %ver%
Source: src/Schema/TransformationLog.php:344
get_transformations_by_severity()
public function get_transformations_by_severity( string $severity ): array
Gets transformations by severity.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$severity | string | Severity to filter by. |
Returns
array— The matching records, keeping their original keys rather than renumbered.
Since: %ver%
Source: src/Schema/TransformationLog.php:360
has_data_loss()
public function has_data_loss(): bool
Checks if any lossy transformations occurred.
Returns
bool
Since: %ver%
Source: src/Schema/TransformationLog.php:374
get_data_loss_summary()
public function get_data_loss_summary(): array
Gets a summary of data loss.
Returns
array
Since: %ver%
Source: src/Schema/TransformationLog.php:391
set_source()
public function set_source( string $platform, $id ): self
Sets the source information.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$platform | string | Platform identifier. | |
$id | string | int | Source identifier. |
Returns
self
Since: %ver%
Source: src/Schema/TransformationLog.php:417
set_target()
public function set_target( string $platform, $id ): self
Sets the target information.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$platform | string | Platform identifier. | |
$id | string | int | Target identifier. |
Returns
self
Since: %ver%
Source: src/Schema/TransformationLog.php:434
get_source_platform()
public function get_source_platform(): string
Gets source platform.
Returns
string
Since: %ver%
Source: src/Schema/TransformationLog.php:448
get_source_id()
public function get_source_id()
Gets source ID.
Returns
string|int
Since: %ver%
Source: src/Schema/TransformationLog.php:459
get_target_platform()
public function get_target_platform(): string
Gets target platform.
Returns
string
Since: %ver%
Source: src/Schema/TransformationLog.php:470
get_target_id()
public function get_target_id()
Gets target ID.
Returns
string|int
Since: %ver%
Source: src/Schema/TransformationLog.php:481
link_previous()
public function link_previous( TransformationLog $previous ): self
Links to a previous transformation log (for round-trips).
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$previous | TransformationLog | Previous transformation log. |
Returns
self
Since: %ver%
Source: src/Schema/TransformationLog.php:494
get_previous()
public function get_previous(): ?TransformationLog
Gets the previous transformation log.
Returns
TransformationLog|null
Since: %ver%
Source: src/Schema/TransformationLog.php:507
is_round_trip()
public function is_round_trip(): bool
Checks if this is part of a round-trip.
Returns
bool
Since: %ver%
Source: src/Schema/TransformationLog.php:518
get_round_trip_depth()
public function get_round_trip_depth(): int
Gets the round-trip depth.
Returns
int
Since: %ver%
Source: src/Schema/TransformationLog.php:529
from_array()
public static function from_array( array $data ): self
Creates from array.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$data | array | Array data. |
Returns
self
Since: %ver%
Source: src/Schema/TransformationLog.php:580
to_array()
public function to_array(): array
Converts to array.
Returns
array
Since: %ver%
Source: src/Schema/TransformationLog.php:615