Fix for Lumen

This commit is contained in:
Maxime Rault 2017-06-09 11:05:19 +02:00
parent ebf2348485
commit dd6771f8fe
4 changed files with 7 additions and 14 deletions

View File

@ -24,8 +24,7 @@ class ODBCZOSConnector extends ODBCConnector
'Protocol=TCPIP', 'Protocol=TCPIP',
'Uid=%s', 'Uid=%s',
'Pwd=%s', 'Pwd=%s',
'', '', // Just to add a semicolon to the end of string
// Just to add a semicolon to the end of string
]; ];
$dsnConfig = [ $dsnConfig = [

View File

@ -101,7 +101,7 @@ class DB2Connection extends Connection
*/ */
protected function getDefaultSchemaGrammar() protected function getDefaultSchemaGrammar()
{ {
return $this->withTablePrefix(new SchemaGrammar($this->config['driver'] == "odbc"?"i":"c")); return $this->withTablePrefix(new SchemaGrammar($this->config['driver'] == 'odbc' ? 'i' : 'c'));
} }
/** /**
@ -115,6 +115,6 @@ class DB2Connection extends Connection
return new DB2ZOSProcessor(); return new DB2ZOSProcessor();
} }
return new DB2Processor($this->config['driver'] == "odbc"?"i":"c"); return new DB2Processor($this->config['driver'] == 'odbc' ? 'i' : 'c');
} }
} }

View File

@ -6,7 +6,6 @@ use Cooperl\Database\DB2\Connectors\ODBCConnector;
use Cooperl\Database\DB2\Connectors\IBMConnector; use Cooperl\Database\DB2\Connectors\IBMConnector;
use Cooperl\Database\DB2\Connectors\ODBCZOSConnector; use Cooperl\Database\DB2\Connectors\ODBCZOSConnector;
use Illuminate\Support\ServiceProvider; use Illuminate\Support\ServiceProvider;
use Config;
/** /**
* Class DB2ServiceProvider * Class DB2ServiceProvider
@ -39,18 +38,13 @@ class DB2ServiceProvider extends ServiceProvider
public function register() public function register()
{ {
// get the configs // get the configs
$conns = is_array(Config::get('laravel-db2::database.connections')) $conns = is_array(config('laravel-db2::database.connections')) ? config('laravel-db2::database.connections') : [];
? Config::get('laravel-db2::database.connections')
: [];
// Add my database configurations to the default set of configurations // Add my database configurations to the default set of configurations
$this->app['config']['database.connections'] = array_merge( config(['database.connections' => array_merge($conns, config('database.connections'))]);
$conns,
$this->app['config']['database.connections']
);
// Extend the connections with pdo_odbc and pdo_ibm drivers // Extend the connections with pdo_odbc and pdo_ibm drivers
foreach (Config::get('database.connections') as $conn => $config) { foreach (config('database.connections') as $conn => $config) {
// Only use configurations that feature a "odbc", "ibm" or "odbczos" driver // Only use configurations that feature a "odbc", "ibm" or "odbczos" driver
if (!isset($config['driver']) || !in_array($config['driver'], ['odbc', 'ibm', 'odbczos', 'odbcexpress'])) { if (!isset($config['driver']) || !in_array($config['driver'], ['odbc', 'ibm', 'odbczos', 'odbcexpress'])) {
continue; continue;

View File

@ -62,7 +62,7 @@ class Blueprint extends \Illuminate\Database\Schema\Blueprint
* *
* @return \Illuminate\Support\Fluent * @return \Illuminate\Support\Fluent
*/ */
protected function indexCommand($type, $columns, $index, $algorithm = NULL) protected function indexCommand($type, $columns, $index, $algorithm = null)
{ {
$columns = (array) $columns; $columns = (array) $columns;