Automattic\WooCommerce\Database\Migrations

MetaToCustomTableMigrator::fetch_sanitized_migration_data()publicWC 1.0

Return data to be migrated for a batch of entities.

Метод класса: MetaToCustomTableMigrator{}

Хуков нет.

Возвращает

Массив[]. Data to be migrated. Would be of the form: array( 'data' => array( ... ), 'errors' => array( ... ) ).

Использование

$MetaToCustomTableMigrator = new MetaToCustomTableMigrator();
$MetaToCustomTableMigrator->fetch_sanitized_migration_data( $entity_ids );
$entity_ids(массив) (обязательный)
Ids of entities to migrate.

Код MetaToCustomTableMigrator::fetch_sanitized_migration_data() WC 9.2.3

public function fetch_sanitized_migration_data( $entity_ids ) {
	$this->clear_errors();
	$data = $this->fetch_data_for_migration_for_ids( $entity_ids );

	foreach ( $data['errors'] as $entity_id => $errors ) {
		foreach ( $errors as $column_name => $error_message ) {
			$this->add_error( "Error importing data for post with id $entity_id: column $column_name: $error_message" );
		}
	}
	return array(
		'data'   => $data['data'],
		'errors' => $this->get_errors(),
	);
}