Sylius/SyliusCartBundle — pull request #40 by winzou (2013-05-23 12:51:38+00:00)
Title: Avoid empty cart to be persisted

This PR aims to avoid empty carts to be persisted in the db.

Currently each time we request the cart from cartProvider, an empty cart is created _and_ flushed.

With this PR, the cart is only created, but not yet flushed. From `CartListener`, we flush the cart (no change here), but also set it back into `CartProvider` in order to set the identifier in the storage layer. So in the end, we create the cart in db only when the first item is added.

I need some thoughts on one point: should the persist/flush of the cart stays in CartListener or should we move it to `CartProvider::setCart()`