Cleanup database logic a bit

This commit is contained in:
Timothy Warren 2019-01-07 14:29:15 -05:00
parent 5d752f6ee3
commit 1c3b478d49
2 changed files with 9 additions and 8 deletions

View File

@ -25,6 +25,12 @@ use PDOException;
*/ */
class Collection extends DB { class Collection extends DB {
/**
* The query builder object
* @var \Query\Query_Builder_Interface
*/
protected $db;
/** /**
* Whether the database is valid for querying * Whether the database is valid for querying
* @var boolean * @var boolean
@ -43,6 +49,7 @@ class Collection extends DB {
try try
{ {
$this->db = \Query($this->dbConfig); $this->db = \Query($this->dbConfig);
$this->validDatabase = TRUE;
} }
catch (PDOException $e) {} catch (PDOException $e) {}
@ -62,9 +69,9 @@ class Collection extends DB {
$this->validDatabase = FALSE; $this->validDatabase = FALSE;
} }
} }
else else if ($this->db === NULL)
{ {
$this->validDatabase = TRUE; $this->validDatabase = FALSE;
} }
} }

View File

@ -24,12 +24,6 @@ use Aviat\Ion\Di\{ContainerAware, ContainerInterface};
class DB { class DB {
use ContainerAware; use ContainerAware;
/**
* The query builder object
* @var \Query\Query_Builder_Interface
*/
protected $db;
/** /**
* The database connection information array * The database connection information array
* @var array $dbConfig * @var array $dbConfig