Skip to content

Instantly share code, notes, and snippets.

@styks1987
Last active April 21, 2017 14:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save styks1987/437f16e1fd290832eff28e171e46ef15 to your computer and use it in GitHub Desktop.
Save styks1987/437f16e1fd290832eff28e171e46ef15 to your computer and use it in GitHub Desktop.
<?php
$shipmentPackagesResponses = $verifyShipment->getPackages();
$shipmentPackages = $shipment->shipment_packages;
foreach($shipmentPackages as $key => &$shipmentPackage){
$shipmentPackage = $shipmentPackage->toArray();
$shipmentPackage['tracking_code'] = $shipmentPackagesResponses[$key]->getTrackingCode();
}
$shipment = $this->Shipments->patchEntity($shipment, ['shipment_packages' => $shipmentPackages], [
'associated' => ['ShipmentPackages']
]);
$this->Shipments->save($shipment, [
'associated' => ['ShipmentPackages']
]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment