#[Route(path: '/store-api/customer/wishlist', name: 'store-api.customer.wishlist.load', methods: ['GET', 'POST'], defaults: ['_loginRequired' => true, '_entity' => 'product'])]
public function load(Request
$request, SalesChannelContext
$context, Criteria
$criteria, CustomerEntity
$customer): LoadWishlistRouteResponse
{ if (!
$this->systemConfigService->
get('core.cart.wishlistEnabled',
$context->
getSalesChannel()->
getId())) { throw CustomerException::
customerWishlistNotActivated();
} $wishlist =
$this->
loadWishlist($context,
$customer->
getId());
$products =
$this->
loadProducts($wishlist->
getId(),
$criteria,
$context,
$request);
return new LoadWishlistRouteResponse($wishlist,
$products);
} private function loadWishlist(SalesChannelContext
$context, string
$customerId): CustomerWishlistEntity
{ $criteria =
new Criteria();
$criteria->
setLimit(1
);
$criteria->
addFilter(new MultiFilter(MultiFilter::CONNECTION_AND,
[ new EqualsFilter('customerId',
$customerId),
new EqualsFilter('salesChannelId',
$context->
getSalesChannel()->
getId()),
]));