Ejemplo n.º 1
0
 /**
  * Create order for given userId
  *
  * @param FrontendUser $user
  * @param mixed        $orderInfo
  *
  * @throws LogicException
  *
  * @return Order $order
  */
 public function createOrderFromCart(FrontendUser $user, $orderInfo)
 {
     if (!$user) {
         throw new LogicException('User object is missing');
     }
     if (count($user->getCart()) == 0) {
         throw new LogicException('User cart is empty');
     }
     $order = $this->dm->getRepository('AiselOrderBundle:Order')->createOrderFromCartForUser($user, $this->getCurrencyCode($orderInfo['locale']), $orderInfo);
     return $order;
 }