/** * Returns an DB instance. Only instanciate the DB if needed, so if you have * caching layer it will avoid creating DB connections for nothing. * * @return \ManiaLib\Database\Connection */ protected function db() { if (!$this->db) { $this->db = \ManiaLib\Database\Connection::getInstance(); } $this->db->select($this->databaseName); return $this->db; }