forked from techdivision/import-cli-simple
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bootstrap.php
57 lines (51 loc) · 1.87 KB
/
bootstrap.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<?php
/**
* bootstrap.php
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
*
* PHP version 5
*
* @author Tim Wagner <[email protected]>
* @copyright 2016 TechDivision GmbH <[email protected]>
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @link https://github.com/techdivision/import-cli-simple
* @link http://www.techdivision.com
*/
// import the used classes
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
use TechDivision\Import\Cli\Utils\DependencyInjectionKeys;
// initialize the DI container and set the vendor directory
$container = new ContainerBuilder();
$container->setParameter(DependencyInjectionKeys::CONFIGURATION_BASE_DIR, dirname(__FILE__));
$container->setParameter(DependencyInjectionKeys::CONFIGURATION_VENDOR_DIR, $vendorDir);
// initialize the default loader and load the DI configuration for the this library
$defaultLoader = new XmlFileLoader($container, new FileLocator($vendorDir));
$defaultLoader->load(
implode(
DIRECTORY_SEPARATOR,
array(
$vendorDir,
'techdivision',
'import-cli',
'symfony',
'Resources',
'config',
'services.xml'
)
)
);
// initialize and run the application
$statusCode = $container->get(DependencyInjectionKeys::APPLICATION)
->run(
$container->get(DependencyInjectionKeys::INPUT),
$container->get(DependencyInjectionKeys::OUTPUT)
);
// stop and render the status code
exit($statusCode);