-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add default db prefix to getDataConnector function calls (#30)
Add two config options for * setting which Laravel database connection should be used * overwriting DataConnector completely with your own custom implementation Fixes bug where DataConnector was not reading the table-name prefix and passing it on to the Celtic library. Much appreciation to the contributors and bug-reporters that drove this release. workon #28 --------- Co-authored-by: Jeroen de Bruijn <jeroen.de.bruijn@brightalley.nl>
- Loading branch information
1 parent
6e20db3
commit 6999a2b
Showing
8 changed files
with
77 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?php | ||
|
||
namespace LonghornOpen\LaravelCelticLTI\DataConnector; | ||
|
||
interface DataConnectorProvider { | ||
public function getDataConnector(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
|
||
namespace LonghornOpen\LaravelCelticLTI\DataConnector; | ||
|
||
class DataConnectorProviderFactory { | ||
public static function getDataConnectorProvider() | ||
{ | ||
$dc_class = config('lti.data_connector_provider', LaravelDataConnectorProvider::class); | ||
return new $dc_class(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
|
||
namespace LonghornOpen\LaravelCelticLTI\DataConnector; | ||
|
||
use ceLTIc\LTI\DataConnector\DataConnector; | ||
use Illuminate\Support\Facades\DB; | ||
use LonghornOpen\LaravelCelticLTI\DataConnector\DataConnectorProvider; | ||
|
||
class LaravelDataConnectorProvider implements DataConnectorProvider | ||
{ | ||
public function getDataConnector() | ||
{ | ||
$connection_name = config('lti.connection_name', config('database.default')); | ||
return $this->getDataConnectorForConnection($connection_name); | ||
} | ||
|
||
public function getDataConnectorForConnection($connection_name) | ||
{ | ||
$pdo = DB::connection($connection_name)->getPdo(); | ||
$dbTableNamePrefix = config('database.connections.' . $connection_name . '.prefix', ''); | ||
return DataConnector::getDataConnector($pdo, $dbTableNamePrefix, 'pdo'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters