Sonata\Component\Basket\BasketFactoryInterface::load PHP Method

load() public method

Load the basket.
public load ( Sonata\Component\Customer\CustomerInterface $customer ) : Sonata\Component\Basket\BasketInterface
$customer Sonata\Component\Customer\CustomerInterface
return Sonata\Component\Basket\BasketInterface
    public function load(CustomerInterface $customer);

Usage Example

Example #1
0
 /**
  * Get the basket.
  *
  * @throws \Exception|\RuntimeException
  *
  * @return \Sonata\Component\Basket\BasketInterface
  */
 public function getBasket()
 {
     if (!$this->basket) {
         try {
             $this->basket = $this->basketFactory->load($this->customerSelector->get());
         } catch (\Exception $e) {
             // something went wrong while loading the basket
             throw $e;
         }
     }
     return $this->basket;
 }
BasketFactoryInterface