Download the PHP package apsconnect/connect-sdk-migration-framework without Composer
On this page you can find all versions of the php package apsconnect/connect-sdk-migration-framework. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download apsconnect/connect-sdk-migration-framework
More information about apsconnect/connect-sdk-migration-framework
Files in apsconnect/connect-sdk-migration-framework
Package connect-sdk-migration-framework
Short Description Small middleware to ease the service migration from legacy to Connect.
License Apache-2.0
Informations about the package connect-sdk-migration-framework
Connect Migration Middleware
Small middleware to ease the service migration from legacy to Connect
Installation
Install via composer:
Usage
Once we have the package installed we need to create a new service provider to inject the middleware into our connector. We need to provide some basic configuration to our migrations service in order to properly migrate the incoming old data.
Configuration parameters
Parameter | Type | Description |
---|---|---|
logger | Psr\Log\LoggerInterface |
The logger instance of our connector. |
migrationFlag | string |
The name of the Connect parameter that stores the legacy data in json format. Default value is migration_info |
serialize | bool |
If true will automatically serialize any non-string value in the migration data on direct assignation flow. Default value is false |
validation | callable |
Custom validation function. Not defined by default. |
onSuccess | callable |
Custom function to execute on migration success. Not defined by default. |
onFail | callable |
Custom function to execute on migration fail. Not defined by default. |
transformations | array |
Assoc array with the connect param id as key and the rule to process the parameter value from the legacy data. Default value is an empty array. |
Input parameters:
validation
:$migrationData
,Request $request
,Config $config
,LoggerInterface $logger
onSuccess
:$migrationData
,Request $request
,Config $config
,LoggerInterface $logger
onFail
:$migrationData
,Request $request
,Config $config
,LoggerInterface $logger
,MigrationAbortException $e
transformations
:$migrationData
,Request $request
,Config $config
,LoggerInterface $logger
Next we need to add this service provider to our configuration json:
And in our ProductFulfillment.php
:
Exceptions
The connect migration middleware uses two different exceptions:
Exception | Description |
---|---|
MigrationParameterFailException |
Can be thrown if any parameter fails on validation and/or transformation, an error will be logged for that parameter, the migration will fail, the fulfillment will be skipped. |
MigrationAbortException |
The migration will directly fail, the fulfillment will be skipped. |
MigrationParameterPassException |
Parameter process will be omitted, other parameters will continue normally. |