Skip to content
This repository was archived by the owner on Oct 1, 2024. It is now read-only.

Commit 9e3fbcb

Browse files
authored
Merge pull request #138 from forsalio/master
Fix connecting to database when package is registered
2 parents a3bb482 + 87f252f commit 9e3fbcb

File tree

2 files changed

+3
-11
lines changed

2 files changed

+3
-11
lines changed

src/Connectors/ConnectionFactory.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?php namespace MStaack\LaravelPostgis\Connectors;
22

3+
use Illuminate\Database\Connection;
34
use PDO;
45
use MStaack\LaravelPostgis\PostgisConnection;
56

@@ -15,8 +16,8 @@ class ConnectionFactory extends \Bosnadev\Database\Connectors\ConnectionFactory
1516
*/
1617
protected function createConnection($driver, $connection, $database, $prefix = '', array $config = [])
1718
{
18-
if ($this->container->bound($key = "db.connection.{$driver}")) {
19-
return $this->container->make($key, [$connection, $database, $prefix, $config]);
19+
if ($resolver = Connection::getResolver($driver)) {
20+
return $resolver($connection, $database, $prefix, $config);
2021
}
2122

2223
if ($driver === 'pgsql') {

src/PostgisConnection.php

-9
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,6 @@
77

88
class PostgisConnection extends PostgresConnection
99
{
10-
public function __construct($pdo, $database = '', $tablePrefix = '', array $config = [])
11-
{
12-
parent::__construct($pdo, $database, $tablePrefix, $config);
13-
14-
// Prevent geography type fields from throwing a 'type not found' error.
15-
$this->getDoctrineSchemaManager()->getDatabasePlatform()->registerDoctrineTypeMapping('geography', 'string');
16-
$this->getDoctrineSchemaManager()->getDatabasePlatform()->registerDoctrineTypeMapping('geometry', 'string');
17-
}
18-
1910
/**
2011
* Get the default schema grammar instance.
2112
*

0 commit comments

Comments
 (0)