PHP code example of leadvertex / plugin-component-process

1. Go to this page and download the library: Download leadvertex/plugin-component-process library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

leadvertex / plugin-component-process example snippets



Leadvertex\Plugin\Components\Process\Process;

$process = new Process($id);
$process->save();

$process->initialize(5);
$process->save();
...

$process->handle();
$process->handle();
$process->handle();
$process->save();
...

$process->skip();
$process->save;
...

$process->addError(new Error('Error message', $entityId));
$process->save();
...

$result = $process->finish(true);
$process->save();

$process->addError(new Error('Entity handle is failed', $entityId));
$process->save();

$errors = $process->getLastErrors();

$process->terminate(new Error('Fatal error', $entityId));
$process->save();

$errors = $process->getLastErrors();

$response = json_encode($process);