I've set up a new database config in application/config/database.php
called staff
.
I've then made a new base model, and added a protected $db
variable and set it in the constructor to $this->db = Database::instance('staff')
.
When I try and replace Db::query(Database::SELECT, $query)
with $this->db->query(Database::SELECT, $query)
, it fails with...
Missing argument 3 for Kohana_Database_MySQL::query()
The 3rd argument I am missing is $as_object
, which is not required when using the static query()
method. My guess is the static method passes this in for me. It actually returns new Database_Query($type, $sql)
.
I think I am doing it wrong.
Is there a way to overload the static Db::query()
I usually use in different classes with the alternate database configuration?
Thanks