Sylius / ShopApiPlugin

Shop API for Sylius.
https://sylius.com
129 stars 89 forks source link

[RFC] AssignCustomerToCartHandler is stateful #666

Open diimpp opened 4 years ago

diimpp commented 4 years ago

https://github.com/Sylius/ShopApiPlugin/blob/3ace12724f53c330d6b894fe2bbe639ecc140d76/src/Handler/Cart/AssignCustomerToCartHandler.php#L42

AssignCustomerToCartHandler uses ShopUserAwareCustomerProvider, which uses loggedInShopUserProvider.

That makes AssignCustomerToCartHandler stateful by depending to currently logged in user.

I think this is not optimal and should be avoided the same way as channel/locale/currency contexts are not used in handlers directly.

mamazu commented 4 years ago

Yeah you are right. This should be a part of the command itself.