security->getUser(); $visitor = $this->userUtils->getVisitorCurrent(); $orderShop = null; $orderShopUser = null; $orderShopVisitor = null; if ($user) { $orderShopUser = $this->orderShopRepo->findCartCurrent([ 'user' => $user ]); } if ($visitor) { $orderShopVisitor = $this->orderShopRepo->findCartCurrent([ 'visitor' => $visitor ]); } if ($orderShopUser || $orderShopVisitor) { // merge if ($orderShopUser && $orderShopVisitor && $orderShopUser != $orderShopVisitor && $orderShopVisitor->getOrderProducts() && count($orderShopVisitor->getOrderProducts())) { $orderShop = $this->mergeOrderShops($orderShopUser, $orderShopVisitor); $this->utils->addFlash('success', "Votre panier visiteur vient d'ĂȘtre fusionnĂ© avec votre panier client."); } else { $orderShop = ($orderShopUser) ? $orderShopUser : $orderShopVisitor; } // set user if ($orderShop && $user && !$orderShop->getUser()) { $orderShop->setUser($user); $this->em->persist($orderShop); $this->em->flush(); } } return $orderShop; } public function isCartAllowToBeOrder($order){ return true; } }