mardi 26 mars 2019

What are chainable and not-chainable setters in PHP/Symfony? [on hold]

While I can say the following is the non-chainable setters.

public function setCategory($category): Product    
{    
    $this->category = $category;    
    return $this;   
}


/**    
* @param $sku    
* @return Product    
*/

public function setSku($sku): Product    
{    
    $this->sku = $sku;    
    return $this;    
}

I am not sure how chainable setters would work. Can I have a simple example for both?

Aucun commentaire:

Enregistrer un commentaire