Esempio n. 1
0
 protected function persistCartItemChildren(array $children, CartItemInterface $parent, CartInterface $cart)
 {
     foreach ($children as $i) {
         $i->setCartId($cart->getCartId())->setAddedTime(new \DateTime())->setParentItemId($parent->getCartItemId())->setParent($parent);
         $this->itemMapper->persist($i);
         $this->persistCartItemChildren($i->getItems(), $i, $cart);
     }
 }
Esempio n. 2
0
 public function persist(CartInterface $cart)
 {
     if ($cart->getCartId() > 0) {
         $where = new Where();
         $where->equalTo($this->cartIdField, $cart->getCartId());
         $this->update($cart, $where, $this->tableName);
     } else {
         $result = $this->insert($cart, $this->tableName);
         $cart->setCartId($result->getGeneratedValue());
     }
     return $cart;
 }