Open diimpp opened 4 years ago
https://github.com/Sylius/ShopApiPlugin/blob/3ace12724f53c330d6b894fe2bbe639ecc140d76/src/Handler/Cart/AssignCustomerToCartHandler.php#L42
AssignCustomerToCartHandler uses ShopUserAwareCustomerProvider, which uses loggedInShopUserProvider.
AssignCustomerToCartHandler
ShopUserAwareCustomerProvider
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.
Yeah you are right. This should be a part of the command itself.
https://github.com/Sylius/ShopApiPlugin/blob/3ace12724f53c330d6b894fe2bbe639ecc140d76/src/Handler/Cart/AssignCustomerToCartHandler.php#L42
AssignCustomerToCartHandler
usesShopUserAwareCustomerProvider
, which usesloggedInShopUserProvider
.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.