ShopApiPlugin icon indicating copy to clipboard operation
ShopApiPlugin copied to clipboard

[RFC] AssignCustomerToCartHandler is stateful

Open diimpp opened this issue 5 years ago • 1 comments

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.

diimpp avatar Jul 28 '20 11:07 diimpp

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

mamazu avatar Jul 29 '20 09:07 mamazu