36 lines
871 B
PHP
36 lines
871 B
PHP
<?php
|
|
|
|
namespace External\VarioBundle\Synchronizers;
|
|
|
|
class StoreSynchronizer extends BaseSynchronizer
|
|
{
|
|
protected static $type = 'otStore';
|
|
|
|
protected $logging = false;
|
|
protected $forceEnd = true;
|
|
protected $fields = [
|
|
'StoreName' => 'name',
|
|
];
|
|
|
|
public function getEshopID($objectID)
|
|
{
|
|
$id = $this->helper->getMapping('vario_stores', $objectID);
|
|
if (!$id) {
|
|
$id = sqlGetConnection()->transactional(function () use ($objectID) {
|
|
$this->insertSQL('stores', ['name' => $objectID]);
|
|
|
|
return (int) sqlInsertId();
|
|
});
|
|
|
|
$this->helper->createMapping('vario_stores', $objectID, $id);
|
|
}
|
|
|
|
return $id;
|
|
}
|
|
|
|
public function syncName($value, $storeId)
|
|
{
|
|
$this->updateSQL('stores', ['name' => $value], ['id' => $storeId]);
|
|
}
|
|
}
|