示例#1
0
文件: Cart.php 项目: margery/thelia
 /**
  * Duplicate an existing Cart. If a customer ID is provided the created cart will be attached to this customer.
  *
  * @param EventDispatcherInterface $dispatcher
  * @param CartModel $cart
  * @param CustomerModel $customer
  * @return CartModel
  */
 protected function duplicateCart(EventDispatcherInterface $dispatcher, CartModel $cart, CustomerModel $customer = null)
 {
     $newCart = $cart->duplicate($this->generateCartCookieIdentifier(), $customer, $this->session->getCurrency(), $dispatcher);
     $cartEvent = new CartEvent($newCart);
     $dispatcher->dispatch(TheliaEvents::CART_DUPLICATE, $cartEvent);
     return $cartEvent->getCart();
 }