Skip to content

Commit

Permalink
Merge pull request #1 from ju5tify/discovery
Browse files Browse the repository at this point in the history
Laravel auto-discovery
  • Loading branch information
mixartemev committed Sep 26, 2018
2 parents 05a8b92 + 4953d3c commit d8b36ff
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
12 changes: 12 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@
"autoload": {
"psr-0": {
"Doctrine\\DBAL\\Driver\\Vertica": "src/"
},
"psr-4": {
"mixartemev\\VerticaDriver\\": "src"
}
},
"autoload-dev": {
Expand All @@ -50,11 +53,20 @@
"ext-pdo": "*",
"ext-odbc": "*",
"doctrine/dbal": "~2.3",
"illuminate/support": "^5.5",
"illuminate/database": "^5.5",
"symfony/options-resolver": "^3.2"
},
"require-dev": {
"phpmd/phpmd": "^2.4",
"squizlabs/php_codesniffer": "^2.7",
"phpunit/phpunit": "^5.6"
},
"extra": {
"laravel": {
"providers": [
"mixartemev\\VerticaDriver\\VerticaDriverServiceProvider"
]
}
}
}
24 changes: 24 additions & 0 deletions src/VerticaDriverServiceProvider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

namespace mixartemev\VerticaDriver;

use Doctrine\DBAL\Driver\Vertica\VerticaDriver;
use Illuminate\Database\PostgresConnection;
use Illuminate\Support\ServiceProvider;

class VerticaDriverServiceProvider extends ServiceProvider
{
/**
*
*/
public function boot()
{
$this->app->bind('db.connector.vertica', function () {
return new VerticaDriver();
});

$this->app->make('db')->resolverFor('vertica', function ($connection, $database, $prefix, $config) {
return new PostgresConnection($connection, $database, $prefix, $config);
});
}
}

0 comments on commit d8b36ff

Please sign in to comment.