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

Commit 28f5284

Browse files
author
Nik Barham
committed
Salvaging fixes from primary-key branch
1 parent 3eb06a5 commit 28f5284

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

src/Database/Connection.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ public function __get($var)
7171
protected $options;
7272
protected $connection;
7373

74+
protected $schemaGenerator;
75+
protected $dataAccess;
76+
7477
protected function __construct($details, $name = 'default', array $options = null, LoggerInterface $logger = null)
7578
{
7679
$this->logger = $logger;
@@ -101,6 +104,8 @@ protected function __construct($details, $name = 'default', array $options = nul
101104
return;
102105
}
103106

107+
$this->schemaGenerator = new SchemaGenerator($this);
108+
$this->dataAccess = new DataAccess($this);
104109

105110
throw new Ex\Database("Not enough details to construct Database object", $details);
106111
}
@@ -145,11 +150,11 @@ public function connect()
145150

146151
public function getDataAccessor()
147152
{
148-
return new DataAccess($this);
153+
return $this->dataAccess;
149154
}
150155

151156
public function getSchemaGenerator()
152157
{
153-
return new SchemaGenerator($this);
158+
return $this->schemaGenerator;
154159
}
155160
}

src/Interfaces/Connection.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,7 @@
77
interface Connection
88
{
99
/**
10-
* Return a PDO instance based on the supplied connection details.
11-
* This object should always return the same PDO instance until ->disconnect() is called.
12-
*
13-
* @return PDO Instance of PDO connection
10+
* Return an object that can be used by the DataAccessor to retrieve results
1411
*/
1512
public function connect();
1613

0 commit comments

Comments
 (0)