Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
remove commentary
  • Loading branch information
Bennett Black committed Nov 8, 2022
1 parent 91acf60 commit 2863980
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 37 deletions.
38 changes: 1 addition & 37 deletions src/DB2DriverServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,43 +9,7 @@ class DB2DriverServiceProvider extends PackageServiceProvider
{
public function configurePackage(Package $package): void
{
// so this works now but.... i shouldn't have to do this right?
$package->name('db2-driver')
->publishesServiceProvider('DB2ServiceProvider');
}

// public function register()
// {
/** #############################################################################################################
*
* cooperl22/laravel-db2 extends the database connection of the database connection you define in database.php.
*
* It does this by searching the database.php for a connection identified with a predefined string (db2_ibmi_odbc).
* This way, only that connection will be overridden. It's done like so:
*
* $this->app['db']->extend('db2_ibmi_odbc', DB2Connection());
*
* I might need to do it this way to prevent myself from overriding all DB connections with what I planned
* to use. Which is :
*
* // In AppServiceProvider@register()
* // Replace 'mysql' with whatever the connection name is...?
* Connection::resolverFor('mysql', function ($connection, $database, $prefix, $config) {
* return new DB2Connection();
* });
*
* We shall see.
*
* ############################################################################################################# */

// $connector = new DB2Connector();

// literally an instantiated PDO with the connection string in it.
// $db2Connection = $connector->connect($config);

// Conditionally return this. What's the condition, though. Does extending DB like this make all connections (sql server, too)
// try to utilize this??
// return new DB2Connection($db2Connection, $config['database'], $config['prefix'], $config);
// return true;
// }
}
}
1 change: 1 addition & 0 deletions src/DB2ServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public function register()
* Override any database connections using the 'db2' driver.
*/
Connection::resolverFor('db2', function ($connection, $database, $prefix, $config) {

$connector = new DB2Connector();

$connection = new Db2Connection($connector->connect($config));
Expand Down

0 comments on commit 2863980

Please sign in to comment.