Sonata\Component\Product\AddBasket::setProductId PHP Method

setProductId() public method

The product id is only set if there is not product attached to this object.
public setProductId ( integer $productId )
$productId integer the product id
    public function setProductId($productId)
    {
        // never erase this value
        if ($this->productId !== null) {
            return;
        }
        $this->productId = $productId;
    }