Skip to content

Commit

Permalink
fix/fix/OP-565 [Wishlist] Issue with multiple wishlists using the sam…
Browse files Browse the repository at this point in the history
…e token
  • Loading branch information
Paweł Piórkowski committed Jan 29, 2025
1 parent 803291a commit c4d6b3e
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions src/CommandHandler/Wishlist/CreateNewWishlistHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,14 @@
final class CreateNewWishlistHandler
{
public function __construct(
private WishlistRepositoryInterface $wishlistRepository,
private TokenStorageInterface $tokenStorage,
private WishlistFactoryInterface $wishlistFactory,
private WishlistRepositoryInterface $wishlistRepository,
private TokenStorageInterface $tokenStorage,
private WishlistFactoryInterface $wishlistFactory,
private WishlistCookieTokenResolverInterface $wishlistCookieTokenResolver,
private ChannelRepositoryInterface $channelRepository,
private WishlistNameCheckerInterface $wishlistNameChecker,
private TokenUserResolverInterface $tokenUserResolver,
)
{
private ChannelRepositoryInterface $channelRepository,
private WishlistNameCheckerInterface $wishlistNameChecker,
private TokenUserResolverInterface $tokenUserResolver,
) {
}

public function __invoke(CreateNewWishlist $createNewWishlist): int
Expand Down Expand Up @@ -74,7 +73,7 @@ public function __invoke(CreateNewWishlist $createNewWishlist): int
} else {
/** @var WishlistInterface $newWishlist */
foreach ($wishlists as $newWishlist) {
if (!$this->wishlistNameChecker->check((string)$newWishlist->getName(), $createNewWishlist->getName())) {
if (!$this->wishlistNameChecker->check((string) $newWishlist->getName(), $createNewWishlist->getName())) {
$wishlist->setName($createNewWishlist->getName());
} else {
throw new WishlistNameIsTakenException();
Expand Down

0 comments on commit c4d6b3e

Please sign in to comment.