/** * Update the object in database * * @param array $props object properties to update * @return int Return the number of affected rows, usually 1, or -1 if the object does not exist * @throws Exception */ public final function update($props) { $props = $this->filterPropsForDb($props); $this->set($props); $clean_props = []; foreach ($props as $propname => $fake) { $clean_props[$propname] = $this->props[$propname]; } if ($this->exists()) { return $this->getDbConnection()->update($this->getTableName(), $clean_props, $this->getPkEquality()) === 1; } throw Exception::noPrimaryKeyToUpdateBy(); }