GuestNotAuthenticatedException example

return $orders->filter(fn (OrderEntity $order) => $order->getCreatedAt() > $latestOrderDate || $order->getUpdatedAt() > $latestOrderDate);
    }

    /** * @throws CustomerNotLoggedInException * @throws WrongGuestCredentialsException * @throws GuestNotAuthenticatedException */
    private function checkGuestAuth(?OrderEntity $order, Request $request): void
    {
        if ($order === null) {
            throw new GuestNotAuthenticatedException();
        }

        $orderCustomer = $order->getOrderCustomer();
        if ($orderCustomer === null) {
            throw CartException::customerNotLoggedIn();
        }

        $guest = $orderCustomer->getCustomer() !== null && $orderCustomer->getCustomer()->getGuest();
        // Throw exception when customer is not guest         if (!$guest) {
            throw CartException::customerNotLoggedIn();
        }
Home | Imprint | This part of the site doesn't use cookies.