<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
integration-helper / integration-version-magento-client example snippets
use IntegrationHelper\IntegrationVersion\Repository\IntegrationVersionRepositoryInterface;
public function __construct(
protected IntegrationVersionRepositoryInterface $integrationVersionRepository,
protected IntegrationVersionManager $integrationVersionManager
){}
public function importsRun() {
foreach ($this->integrationVersionRepository->getItems() as $item) {
$source = $item->getSource();
$latestOutputData = $this->integrationVersionManager->getLatestHashData($source);
if($latestOutputData->isError()) {
$this->integrationVersionManager->saveLatestHash($source, $latestOutputData);
continue;
}
$identities = [];
foreach (
$this->integrationVersionManager
->getIdentities(
$source,
$item->getHash(),
$item->getUpdatedAtValue())
as $items) {
$identities[] = //.... get identities
}
//Get Yours Api request from Mapped $source-$request
if($identities) {
$request->importByIdentities($identities);
//Request by Api and get Items by ids
}
}
}
Vendor\ApiAppIntegrationVersion\Service\RunImports:
declare(strict_types=1);
namespace Vendor\ApiAppIntegrationVersion\Service;
use IntegrationHelper\IntegrationVersion\Repository\IntegrationVersionRepositoryInterface;
use IntegrationHelper\IntegrationVersionMagentoClient\Service\IntegrationVersionManager;
use IntegrationHelper\IntegrationVersion\Model\IntegrationVersionInterface;
class RunImports
{
public function __construct(
protected IntegrationVersionRepositoryInterface $integrationVersionRepository,
protected IntegrationVersionManager $integrationVersionManager
){}
/**
* @param array $args
* @return void
*/
public function execute()
{
/**
* @var $item IntegrationVersionInterface
*/
foreach ($this->integrationVersionRepository->getItems() as $item) {
$source = $item->getSource();
$latestOutputData = $this->integrationVersionManager->getLatestHashData($source);
if($latestOutputData->isError()) {
$this->integrationVersionManager->saveLatestHash($source, $latestOutputData);
continue;
}
$identities = [];
foreach (
$this->integrationVersionManager
->getIdentities(
$source,
$item->getHash(),
$item->getUpdatedAtValue())
as $items) {
// $identities[] = //.... get identities
}
if($identities) {
//Request by Api and get Items by ids
}
}
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.