예제 #1
0
 /**
  * Migrates the addresses from the old basket to the current one.
  *
  * @param \Aimeos\MShop\Order\Item\Base\Iface $basket Basket object
  * @param array $errors Associative list of previous errors
  * @param string $localeKey Unique identifier of the site, language and currency
  * @return array Associative list of errors occured
  */
 protected function copyAddresses(\Aimeos\MShop\Order\Item\Base\Iface $basket, array $errors, $localeKey)
 {
     foreach ($basket->getAddresses() as $type => $item) {
         try {
             $this->setAddress($type, $item->toArray());
             $basket->deleteAddress($type);
         } catch (\Exception $e) {
             $logger = $this->getContext()->getLogger();
             $str = 'Error migrating address with type "%1$s" in basket to locale "%2$s": %3$s';
             $logger->log(sprintf($str, $type, $localeKey, $e->getMessage()), \Aimeos\MW\Logger\Base::INFO);
             $errors['address'][$type] = $e->getMessage();
         }
     }
     return $errors;
 }