Search code examples
prestashopprestashop-1.7

Prestashop 1.7: Differences between save and update?


In PS 17, are there any differences between the objects models save and update methods?


Solution

  • save() method calls update() if object already exists.

    public function save($null_values = false, $auto_date = true)
    {
        return (int) $this->id > 0 ? $this->update($null_values) : $this->add($auto_date, $null_values);
    }
    

    So you can call one or the other indistinctly if you know that the object exists.