-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBootstrap.php
More file actions
66 lines (56 loc) · 2.12 KB
/
Bootstrap.php
File metadata and controls
66 lines (56 loc) · 2.12 KB
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
58
59
60
61
62
63
64
65
66
<?php
namespace Application;
use Zend\Mvc\AppContext as AppContext,
Zend\Mvc\Bootstrap as ZendBootstrap,
Zend\Loader\AutoloaderFactory;
define('APPLICATION_PATH', '/home/andb/projects/acmf2');
require_once 'Zend/Mvc/Bootstrapper.php';
require_once 'Zend/Mvc/Bootstrap.php';
class Bootstrap extends ZendBootstrap
{
/**
*
* @var \Zend\Module\Manager
*/
protected $moduleManager = null;
public function __construct() {
$this->initStandartAutoloader(); // Инициализируем стандартный автозагрузчик
$appConfig = $this->getAppConfig();
$moduleManager = new \Zend\Module\Manager($appConfig['modules']);
$listenerOptions = new \Zend\Module\Listener\ListenerOptions($appConfig['module_listener_options']);
$defaultListeners = new \Zend\Module\Listener\DefaultListenerAggregate($listenerOptions);
$config = $defaultListeners->getConfigListener();
$config->addConfigGlobPaths($appConfig['globConfPath']);
$moduleManager->events()->attachAggregate($defaultListeners);
$moduleManager->loadModules();
parent::__construct($config->getMergedConfig());
}
protected function getAppConfig() {
return array(
'modules' => array(
'myBlog',
'EdpCommon',
'EdpUser',
'Application',
),
'globConfPath' => array(
realpath(__DIR__ . '/config').'/*.php',
),
'module_listener_options' => array(
'ConfigCacheEnabled' => false,
'CacheDir' => realpath(__DIR__ . '/data/cache'),
'ConfigCacheKey' => 'cache',
'module_paths' => array(
realpath(__DIR__ . '/modules'),
realpath(__DIR__ . '/../zfModules')
),
),
);
}
protected function initStandartAutoloader() {
require_once 'Zend/Loader/AutoloaderFactory.php';
AutoloaderFactory::factory(array(
'Zend\Loader\StandardAutoloader' => array()
));
}
}