GravityKit\GravityMigrate\Schema\FieldMapper
Maps field types bidirectionally between platforms.
Platform → Universal → Platform translation, with an assessment of what a conversion loses and whether it can be reversed.
Since: %ver%
Source: src/Schema/FieldMapper.php:20
Details
- Kind:
class - Namespace:
GravityKit\GravityMigrate\Schema
Methods
| Method | Description |
|---|---|
normalize_platform() | Normalizes a platform identifier to its canonical underscored id. |
to_universal() | Maps a field type from source platform to universal type. |
from_universal() | Maps a universal field type to target platform type. |
fallback_type() | Returns the plain text field type for a platform, used when nothing else matches. |
map_between_platforms() | Maps a field type directly between platforms. |
assess_round_trip_fidelity() | Whether a field type survives being exported and brought back. |
get_supported_types() | Gets all supported field types for a platform. |
is_supported() | Checks if a field type is supported by a platform. |
get_universal_to_platform_map_for() | Gets the universal-to-platform mapping for a platform. |
Method Reference
normalize_platform()
public static function normalize_platform( string $platform ): string
Normalizes a platform identifier to its canonical underscored id.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$platform | string | Platform identifier (canonical or runtime slug). |
Returns
string— Canonical platform id.
Since: %ver%
Source: src/Schema/FieldMapper.php:100
to_universal()
public static function to_universal( string $source_type, string $platform ): string
Maps a field type from source platform to universal type.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$source_type | string | Source field type. | |
$platform | string | Source platform identifier. |
Returns
string— Universal field type.
Since: %ver%
Source: src/Schema/FieldMapper.php:114
from_universal()
public static function from_universal( string $universal_type, string $platform ): string
Maps a universal field type to target platform type.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$universal_type | string | Universal field type. | |
$platform | string | Target platform identifier. |
Returns
string— Target platform field type.
Since: %ver%
Source: src/Schema/FieldMapper.php:130
fallback_type()
public static function fallback_type( string $platform ): string
Returns the plain text field type for a platform, used when nothing else matches.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$platform | string | Target platform identifier. |
Returns
string
Since: %ver%
Source: src/Schema/FieldMapper.php:152
map_between_platforms()
public static function map_between_platforms( string $source_type, string $source_platform, string $target_platform ): array
Maps a field type directly between platforms.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$source_type | string | Source field type. | |
$source_platform | string | Source platform identifier. | |
$target_platform | string | Target platform identifier. |
Returns
array— Carries 'type', 'universal_type', 'is_lossy', 'is_exact_match', 'loss_description' and 'transformation_log_severity'.
Since: %ver%
Source: src/Schema/FieldMapper.php:170
assess_round_trip_fidelity()
public static function assess_round_trip_fidelity( string $original_type, string $source_platform, string $target_platform ): array
Whether a field type survives being exported and brought back.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$original_type | string | Original field type. | |
$source_platform | string | Original source platform. | |
$target_platform | string | Platform it was exported to. |
Returns
array— Carries 'can_restore', 'restored_type', 'intermediate_type', 'fidelity_loss' and 'is_lossless'.
Since: %ver%
Source: src/Schema/FieldMapper.php:240
get_supported_types()
public static function get_supported_types( string $platform ): array
Gets all supported field types for a platform.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$platform | string | Platform identifier. |
Returns
array— List of supported field types.
Since: %ver%
Source: src/Schema/FieldMapper.php:281
is_supported()
public static function is_supported( string $field_type, string $platform ): bool
Checks if a field type is supported by a platform.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$field_type | string | Field type to check. | |
$platform | string | Platform identifier. |
Returns
bool
Since: %ver%
Source: src/Schema/FieldMapper.php:297
get_universal_to_platform_map_for()
public static function get_universal_to_platform_map_for( string $platform ): array
Gets the universal-to-platform mapping for a platform.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$platform | string | Platform identifier. |
Returns
array
Since: %ver%
Source: src/Schema/FieldMapper.php:334