Cybo Advanced Field EngineCyboweb Technologies · Documentation · v1.0.2

cafe_register_migration_source()

Purpose

Adds your own source to CAFE → Migration, for data CAFE cannot read by itself: an old CRM, an API export, a database with an unusual layout. Your source only reads; the Connector maps, transforms, validates and writes through CAFE's API.

Syntax

cafe_register_migration_source( Cybo\AdvancedFieldEngine\Connector\Source\SourceAdapterInterface $source ): bool

Parameters

Parameter Type Default Description
$source SourceAdapterInterface - Your source. Its name must use lowercase letters, digits and underscores and must not be taken.

Return value

true when registered, false for an invalid or taken name (with a _doing_it_wrong() notice).

Example

add_action( 'cafe_register_migration_sources', function () {
	cafe_register_migration_source( new My_Crm_Source() );
} );

A complete source is in Custom sources.

Notes

  • Call it on the cafe_register_migration_sources action.
  • get_records() must return records in a stable order and load a whole batch with as few queries as possible (never one query per record).
  • Built-in names (wordpress, acf, database, csv, json) cannot be replaced.
  • Since 0.13.0.