throw new DecorationPatternException(self::
class);
} #[Route(path: '/store-api/customer/wishlist/add/{productId}', name: 'store-api.customer.wishlist.add', methods: ['POST'], defaults: ['_loginRequired' => true])]
public function add(string
$productId, SalesChannelContext
$context, CustomerEntity
$customer): SuccessResponse
{ if (!
$this->systemConfigService->
get('core.cart.wishlistEnabled',
$context->
getSalesChannel()->
getId())) { throw CustomerException::
customerWishlistNotActivated();
} $this->
validateProduct($productId,
$context);
$wishlistId =
$this->
getWishlistId($context,
$customer->
getId());
$this->wishlistRepository->
upsert([ [ 'id' =>
$wishlistId,
'customerId' =>
$customer->
getId(),
'salesChannelId' =>
$context->
getSalesChannel()->
getId(),
'products' =>
[ [ 'productId' =>
$productId,
'productVersionId' => Defaults::LIVE_VERSION,
],
],