Exemplo n.º 1
0
 public function getCurrentCart()
 {
     if ($this->currentCart === null) {
         $currentCart = null;
         if ($this->cartSession->cartId !== null) {
             $currentCart = $this->cartService->getById($this->cartSession->cartId);
         }
         if ($currentCart === null) {
             /** @var User|null $identity */
             $identity = $this->user->getIdentity();
             $currentCart = new Cart($identity);
         }
         $this->currentCart = $currentCart;
     }
     return $this->currentCart;
 }