fix: pass optional return value to database Model->set()

This commit is contained in:
Victor Westerlund 2026-02-16 15:04:38 +01:00
parent 19e15c0b23
commit 7793904c06
Signed by: vlw
GPG key ID: D0AD730E1057DFC6

View file

@ -97,9 +97,10 @@
* *
* @param string $key Target column to update * @param string $key Target column to update
* @param mixed $value New value of target column * @param mixed $value New value of target column
* @param return $return (optional) Return this instead of $value when set
* @return mixed The value that was sent to $value * @return mixed The value that was sent to $value
*/ */
public function set(string $key, mixed $value): mixed { public function set(string $key, mixed $value, mixed $return = null): mixed {
$this->_row[$key] = $value; $this->_row[$key] = $value;
$this->db $this->db
@ -107,6 +108,6 @@
->where($this->where) ->where($this->where)
->update([$key => $value]); ->update([$key => $value]);
return $value; return $return ?? $value;
} }
} }