Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
e54fc079
Commit
e54fc079
authored
Jul 01, 2012
by
Katherine Bailey
Browse files
Adding the default and slave database connections as services
parent
8122811d
Changes
1
Hide whitespace changes
Inline
Side-by-side
core/lib/Drupal/Core/DrupalBundle.php
View file @
e54fc079
...
...
@@ -22,6 +22,7 @@ public function build(ContainerBuilder $container)
'tags'
=>
array
(),
'references'
=>
array
(),
'methods'
=>
array
(),
'arguments'
=>
array
(),
);
$references
=
array
();
...
...
@@ -31,6 +32,15 @@ public function build(ContainerBuilder $container)
$definition
=
new
Definition
(
$info
[
'class'
],
$references
);
if
(
isset
(
$info
[
'factory_class'
])
&&
isset
(
$info
[
'factory_method'
]))
{
$definition
->
setFactoryClass
(
$info
[
'factory_class'
]);
$definition
->
setFactoryMethod
(
$info
[
'factory_method'
]);
}
foreach
(
$info
[
'arguments'
]
as
$argument
)
{
$definition
->
addArgument
(
$argument
);
}
foreach
(
$info
[
'tags'
]
as
$tag
)
{
$definition
->
addTag
(
$tag
);
}
...
...
@@ -122,6 +132,18 @@ function getDefinitions() {
'references'
=>
array
(
'exception_controller'
),
'tags'
=>
array
(
'kernel.event_subscriber'
)
),
'database'
=>
array
(
'class'
=>
'Drupal\Core\Database\Connection'
,
'factory_class'
=>
'Drupal\Core\Database\Database'
,
'factory_method'
=>
'getConnection'
,
'arguments'
=>
array
(
'default'
),
),
'database.slave'
=>
array
(
'class'
=>
'Drupal\Core\Database\Connection'
,
'factory_class'
=>
'Drupal\Core\Database\Database'
,
'factory_method'
=>
'getConnection'
,
'arguments'
=>
array
(
'slave'
),
),
);
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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