Instead of calling \Drupal\uc_cart\Controller\Cart::create(\Drupal::getContainer()); we should be able to use something like \Drupal::service('uc_cart.manager')->getCart() to return an object that represents the cart for the current user. We are part way there with the Cart controller object but none of the methods should take a cart ID as a parameter. Unsure whether these can be a true entity object/manager because of the special way we handle cart IDs for anonymous and registered users, but that would be a good end goal.
| Comment | File | Size | Author |
|---|---|---|---|
| #22 | cart-manager-22.patch | 54.47 KB | longwave |
Comments
Comment #2
tr commentedYes, that was my intent, just never finished that. Hence the awkward construction. The API for the cart service deserves a bit of thought - the set of functions we have now is incomplete and inadequate.
Comment #3
longwaveFirst pass at this. Some tests will probably fail and there is more cleanup that can be done, such as removing the $msg parameter from Cart::addItem(). Also unsure if CartManager::completeSale() really belongs there, or if this should be moved to the Order system.
Comment #7
longwaveComment #11
longwaveComment #15
longwaveComment #19
longwave@TR: any comments on this would be appreciated!
Comment #22
longwaveComment #23
longwave