Skip to content
This repository was archived by the owner on May 12, 2022. It is now read-only.

Commit 7ab9457

Browse files
brokencubeNik Barham
authored andcommitted
Fix Connection object to not return before assigning DataAccessor/SchemaGenerator
1 parent 28f5284 commit 7ab9457

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/Database/Connection.php

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -96,18 +96,16 @@ protected function __construct($details, $name = 'default', array $options = nul
9696
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION
9797
];
9898
$this->type = $details['type'] ?: 'mysql';
99-
99+
100100
if ($this->unix_socket && $this->host) {
101101
throw new Ex\Database("Must use host OR unix_socket - both supplied", $details);
102102
}
103103

104-
return;
104+
$this->schemaGenerator = new SchemaGenerator($this);
105+
$this->dataAccess = new DataAccess($this);
106+
} else {
107+
throw new Ex\Database("Not enough details to construct Database object", $details);
105108
}
106-
107-
$this->schemaGenerator = new SchemaGenerator($this);
108-
$this->dataAccess = new DataAccess($this);
109-
110-
throw new Ex\Database("Not enough details to construct Database object", $details);
111109
}
112110

113111
/**

0 commit comments

Comments
 (0)