forked from ezsystems/ezpublish-kernel
-
Notifications
You must be signed in to change notification settings - Fork 0
/
container.php
38 lines (33 loc) · 1.07 KB
/
container.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
/**
* File generates service container instance
*
* Expects global $settings to be set by caller
*
* @deprecated Since 5.0, this is only used for unit tests.
* @copyright Copyright (C) 1999-2013 eZ Systems AS. All rights reserved.
* @license http://www.gnu.org/licenses/gpl-2.0.txt GNU General Public License v2
* @version //autogentag//
*/
use eZ\Publish\Core\Base\ConfigurationManager;
use eZ\Publish\Core\Base\ServiceContainer;
if ( !isset( $settings ) )
{
throw new \RuntimeException( '$settings not provided to container.php' );
}
// Setup Configuration object to be able to read service.ini settings
$configManager = new ConfigurationManager(
$settings,
$settings['base']['Configuration']['Paths']
);
// [temp] Inject legacy kernel, as it does not yet have a factory
$dependencies = array();
if ( isset( $_ENV['legacyKernel'] ) )
{
$dependencies['@legacyKernel'] = $_ENV['legacyKernel'];
}
// Return Service container with service.ini settings
return new ServiceContainer(
$configManager->getConfiguration( 'service' )->getAll(),
$dependencies
);