I have what it must be a very simple method, but it's unexpectedly diying at 'return' line and not throwing any errors. I already enabled error reporting E_All; I already checked apache error_log;
What am I missing?
public function get_by_state_id(int $state_id){
    $db = new mysqli('localhost', 'root', '', 'foo');
    $query = "
        SELECT *
        FROM {$this->table}
        WHERE state_id = ?
        ORDER BY name";
    if($stmt = $db->prepare($query)){
        $stmt->bind_param('i',$state_id);
        $stmt->execute();
        $res = $stmt->get_result();
        $rows = [];
        while($obj = $res->fetch_object()){
            $rows[] = $obj;
        }
        return $rows;
    }
}
