refactor: replace for() with from() in database Model (#7)

This PR replaces the `vlw\MySQL->for()` with `vlw\MySQL->from()` since for() it's deprecated.

Reviewed-on: https://codeberg.org/vlw/scaffold/pulls/7
This commit is contained in:
Victor Westerlund 2025-11-01 16:37:26 +01:00
parent 1940d89352
commit 716891a6f4

View file

@ -55,7 +55,7 @@
$this->_resolved = true; $this->_resolved = true;
$this->_row = $this->db $this->_row = $this->db
->for($this->table) ->from($this->table)
->where($this->where) ->where($this->where)
->limit(1) ->limit(1)
->select($this->columns) ->select($this->columns)
@ -75,11 +75,11 @@
public bool $isset { public bool $isset {
// Returns bool if row is set or attempts to resolve and set if null // Returns bool if row is set or attempts to resolve and set if null
get => $this->_isset ??= new Database() get => $this->_isset ??= new Database()
->for($this->table) ->from($this->table)
->where($this->where) ->where($this->where)
->limit(1) ->limit(1)
->select() ->select()
->num_rows === 1; ->num_rows === 1;
} }
/** /**
@ -103,7 +103,7 @@
$this->_row[$key] = $value; $this->_row[$key] = $value;
return $this->db return $this->db
->for($this->table) ->from($this->table)
->where($this->where) ->where($this->where)
->update([$key => $value]); ->update([$key => $value]);
} }