Sonata\BasketBundle\Controller\Api\BasketController::checkExistingCustomerBasket PHP Method

checkExistingCustomerBasket() protected method

Throws an exception if it already exists a basket with a specific customer id.
protected checkExistingCustomerBasket ( $customerId )
$customerId
    protected function checkExistingCustomerBasket($customerId)
    {
        $basket = $this->basketManager->findOneBy(array('customer' => $customerId));
        if ($basket instanceof BasketInterface) {
            throw new HttpException('400', sprintf('Customer (%d) already has a basket', $customerId));
        }
    }