Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
syncEnrollments
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Yeray Santana Hualde
syncEnrollments
Commits
893acd87
Commit
893acd87
authored
Oct 16, 2011
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tweaking and refactoring the database connectors. added connectors to the container.
parent
07f3f5d0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
18 deletions
+31
-18
container.php
laravel/config/container.php
+27
-0
manager.php
laravel/database/manager.php
+4
-18
No files found.
laravel/config/container.php
View file @
893acd87
...
...
@@ -39,6 +39,33 @@ return array(
return
new
Routing\Caller
(
$c
,
require
APP_PATH
.
'filters'
.
EXT
,
CONTROLLER_PATH
);
}),
/*
|--------------------------------------------------------------------------
| Laravel Database Connectors
|--------------------------------------------------------------------------
|
| The following components are used to establish PDO database connections
| to the various database systems supported by Laravel. By resolving these
| connectors out of the IoC container, new database systems may be added
| by simply registering a connector.
|
*/
'laravel.database.connectors.sqlite'
=>
function
(
$c
)
{
return
new
Database\Connectors\SQLite
;
},
'laravel.database.connectors.mysql'
=>
function
(
$c
)
{
return
new
Database\Connectors\MySQL
;
},
'laravel.database.connectors.pgsql'
=>
function
(
$c
)
{
return
new
Database\Connectors\Postgres
;
},
/*
|--------------------------------------------------------------------------
| Laravel Caching Components
...
...
laravel/database/manager.php
View file @
893acd87
<?php
namespace
Laravel\Database
;
use
Laravel\IoC
;
use
Laravel\Config
;
class
Manager
{
...
...
@@ -56,27 +57,12 @@ class Manager {
*/
protected
static
function
connect
(
$config
)
{
if
(
isset
(
$config
[
'connector'
]))
{
return
call_user_func
(
$config
[
'connector'
],
$config
);
}
switch
(
$config
[
'driver'
])
if
(
isset
(
$config
[
'connector'
]))
{
case
'sqlite'
:
$connector
=
new
Connectors\SQLite
;
break
;
case
'mysql'
:
$connector
=
new
Connectors\MySQL
;
break
;
case
'pgsql'
:
$connector
=
new
Connectors\Postgres
;
break
;
default
:
throw
new
\Exception
(
"Database driver [
{
$config
[
'driver'
]
}
] is not supported."
);
return
call_user_func
(
$config
[
'connector'
],
$config
);
}
return
$connector
->
connect
(
$config
);
return
IoC
::
container
()
->
core
(
"database.connectors.
{
$config
[
'driver'
]
}
"
)
->
connect
(
$config
);
}
/**
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment