-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathbootstrap.php
44 lines (38 loc) · 1.75 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
<?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 <t.wagner@techdivision.com>
* @copyright 2016 TechDivision GmbH <info@techdivision.com>
* @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_VENDOR_DIR, $vendorDir);
$container->setParameter(DependencyInjectionKeys::CONFIGURATION_BASE_DIR, dirname(__FILE__));
// 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);