GravityKit\GravityMigrate\Importers\Adapters\SourceConversion
The outcome of converting one source form: the form as the hub stores one, and what the
conversion had to say about it.
This is the seam between a source adapter's own work and the sequence the base class runs
around it. An adapter hands one of these back from \AbstractSourceAdapter::convert();
the base normalizes the form, checks it, adds what every import reports the same way, and
assembles the prepared payload.
Named methods rather than array keys, so a report channel an adapter forgets is an absent
call rather than an absent key -- and a misspelled one is a fatal on the first test that
reaches it, where $result['warings'] would be silent forever.
The form is still a Gravity Forms array. That is deliberate: this object fixes WHERE the hub form crosses from adapter to base, so that changing WHAT crosses is one edit here rather than seven.
Since: %ver%
Source: src/Importers/Adapters/SourceConversion.php:29
Details
- Kind:
class - Namespace:
GravityKit\GravityMigrate\Importers\Adapters
Methods
| Method | Description |
|---|---|
of() | A conversion that produced this hub form for this source form. |
add_warnings() | Adds what the conversion could not carry, in sentences. |
add_unsupported() | Adds the source fields nothing could be made of. |
add_addon_requirements() | Adds the add-ons the converted form needs. |
set_field_map() | Records which hub field each source field became. |
add_notices() | Adds statements of fact that are not losses. |
source_id() | The source form's own id. |
gf_form() | The form as the hub stores one, before normalization. |
warnings() | What the conversion could not carry, in sentences. |
unsupported() | The source fields nothing could be made of. |
addon_requirements() | The add-ons the converted form needs. |
field_map() | Source field identifier => hub field id. |
notices() | Statements of fact that are not losses. |
Method Reference
of()
public static function of( $source_id, array $gf_form ): self
A conversion that produced this hub form for this source form.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$source_id | int | string | The source form's own id. | |
$gf_form | array | The form as the hub stores one, before normalization. |
Returns
self
Since: %ver%
Source: src/Importers/Adapters/SourceConversion.php:115
add_warnings()
public function add_warnings( array $warnings ): self
Adds what the conversion could not carry, in sentences.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$warnings | string[] | Sentences. Duplicates and blanks are dropped when reported. |
Returns
self
Since: %ver%
Source: src/Importers/Adapters/SourceConversion.php:128
add_unsupported()
public function add_unsupported( array $unsupported ): self
Adds the source fields nothing could be made of.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$unsupported | array | As the adapter's field mapper collected them: labels, or records carrying a label, one entry per FIELD. |
Returns
self
Since: %ver%
Source: src/Importers/Adapters/SourceConversion.php:144
add_addon_requirements()
public function add_addon_requirements( array $requirements ): self
Adds the add-ons the converted form needs.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$requirements | string[] | Sentences, or add-on names. |
Returns
self
Since: %ver%
Source: src/Importers/Adapters/SourceConversion.php:159
set_field_map()
public function set_field_map( array $field_map ): self
Records which hub field each source field became.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$field_map | array | Source field identifier => hub field id. |
Returns
self
Since: %ver%
Source: src/Importers/Adapters/SourceConversion.php:174
add_notices()
public function add_notices( array $notices ): self
Adds statements of fact that are not losses.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$notices | string[] | Sentences. |
Returns
self
Since: %ver%
Source: src/Importers/Adapters/SourceConversion.php:189
source_id()
public function source_id()
The source form's own id.
Returns
int|string
Since: %ver%
Source: src/Importers/Adapters/SourceConversion.php:202
gf_form()
public function gf_form(): array
The form as the hub stores one, before normalization.
Returns
array
Since: %ver%
Source: src/Importers/Adapters/SourceConversion.php:213
warnings()
public function warnings(): array
What the conversion could not carry, in sentences.
Returns
string[]
Since: %ver%
Source: src/Importers/Adapters/SourceConversion.php:224
unsupported()
public function unsupported(): array
The source fields nothing could be made of.
Returns
array
Since: %ver%
Source: src/Importers/Adapters/SourceConversion.php:235
addon_requirements()
public function addon_requirements(): array
The add-ons the converted form needs.
Returns
string[]
Since: %ver%
Source: src/Importers/Adapters/SourceConversion.php:246
field_map()
public function field_map(): array
Source field identifier => hub field id.
Returns
array
Since: %ver%
Source: src/Importers/Adapters/SourceConversion.php:257
notices()
public function notices(): array
Statements of fact that are not losses.
Returns
string[]
Since: %ver%
Source: src/Importers/Adapters/SourceConversion.php:268