41 lines
1.0 KiB
PHP
41 lines
1.0 KiB
PHP
<?php
|
|
|
|
/**
|
|
* Subclass for performing query and update operations on the 'st_paczkomaty_dispatch_order' table.
|
|
*
|
|
*
|
|
*
|
|
* @package plugins.stPaczkomatyPlugin.lib.model
|
|
*/
|
|
class PaczkomatyDispatchOrderPeer extends BasePaczkomatyDispatchOrderPeer
|
|
{
|
|
public static function doSelectWithShipX(Criteria $c, $con = null)
|
|
{
|
|
/**
|
|
* @var PaczkomatyDispatchOrder[]
|
|
*/
|
|
$results = [];
|
|
$ids = [];
|
|
|
|
foreach (parent::doSelect($c, $con) as $index => $result)
|
|
{
|
|
$ids[] = $result->getDispatchOrderId();
|
|
$results[empty($result->getDispatchOrderId()) ? $index : $result->getDispatchOrderId()] = $result;
|
|
}
|
|
|
|
$api = stInPostApi::getInstance();
|
|
$response = $api->getDispatchOrders($ids);
|
|
|
|
foreach ($response->items as $item)
|
|
{
|
|
if (isset($results[$item->id]))
|
|
{
|
|
$results[$item->id]->setStatus($item->status);
|
|
$results[$item->id]->save();
|
|
}
|
|
}
|
|
|
|
return $results;
|
|
}
|
|
}
|