private function setHistory($shopId) { $user = $this->getUser(); $session = $this->getRequest()->getSession(); $basket = $session->get('basket'); $books = $basket->getProduct(); $Basket = array(); foreach ($books as $id => $book) { $shop = $book['shop']; if ($shop == $shopId) { $Basket['obj'][$id]['count'] = $book['count']; $Basket['obj'][$id]['book'] = $book['book']; $Basket['summa'] = $basket->getPrice($shop); $Basket['count'] = $basket->countProducts($shop); } } $order = serialize($Basket); $em = $this->getDoctrine()->getManager(); $history = new MarketHistory(); $history->setUser($user); $history->setBody($order); $em->persist($history); $em->flush(); }
private function setHistory() { $user = $this->getUser(); $session = $this->getRequest()->getSession(); $basket = $session->get('basket'); $basket = serialize($basket); $em = $this->getDoctrine()->getManager(); $history = new MarketHistory(); $history->setUser($user); $history->setBody($basket); $em->persist($history); $em->flush(); }