/** * Saves the properties to the database. * * This performs an intelligent insert/update, and reloads the * properties with fresh data from the table on success. * * @return mixed The primary key value(s), as an associative array if the * key is compound, or a scalar if the key is single-column. */ public function save() { // Since this object is frequently stored in the session, we should // reconnect to the database as part of the save action to prevent // exceptions: $this->sql = new Sql(GlobalAdapterFeature::getStaticAdapter(), $this->table); return parent::save(); }
/** * Saves the properties to the database. * * This performs an intelligent insert/update, and reloads the * properties with fresh data from the table on success. * * @param \VuFind\Db\Row\User|bool $user Logged-in user (false if none) * * @return mixed The primary key value(s), as an associative array if the * key is compound, or a scalar if the key is single-column. * @throws ListPermissionException * @throws MissingFieldException */ public function save($user = false) { if (!$this->editAllowed($user)) { throw new ListPermissionException('list_access_denied'); } if (empty($this->title)) { throw new MissingFieldException('list_edit_name_required'); } parent::save(); $this->rememberLastUsed(); return $this->id; }