|
15 | 15 | use Monarc\Core\Service\DoctrineCacheServiceFactory; |
16 | 16 | use Monarc\Core\Service\DoctrineLoggerFactory; |
17 | 17 |
|
18 | | -$appconfdir = getenv('APP_CONF_DIR') ?? ''; |
19 | | - |
20 | | -$datapath = "data"; |
21 | | -if (!empty($appconfdir)) { |
22 | | - $datapath = $appconfdir . '/data'; |
| 18 | +$dataPath = 'data'; |
| 19 | +if (defined('DATA_PATH')) { |
| 20 | + $dataPath = DATA_PATH; |
| 21 | +} elseif (getenv('APP_CONF_DIR')) { |
| 22 | + $dataPath = getenv('APP_CONF_DIR') . '/data'; |
23 | 23 | } |
24 | 24 |
|
25 | | -return array( |
| 25 | +return [ |
26 | 26 | // DOCTRINE CONF |
27 | | - 'service_manager' => array( |
28 | | - 'factories' => array( |
| 27 | + 'service_manager' => [ |
| 28 | + 'factories' => [ |
29 | 29 | 'doctrine.cache.mycache' => DoctrineCacheServiceFactory::class, |
30 | 30 | 'doctrine.monarc_logger' => DoctrineLoggerFactory::class, |
31 | | - ), |
32 | | - ), |
33 | | - 'doctrine' => array( |
34 | | - 'connection' => array( |
35 | | - 'orm_default' => array( |
| 31 | + ], |
| 32 | + ], |
| 33 | + 'doctrine' => [ |
| 34 | + 'connection' => [ |
| 35 | + 'orm_default' => [ |
36 | 36 | 'driverClass' => Driver::class, |
37 | | - 'params' => array( |
| 37 | + 'params' => [ |
38 | 38 | 'host' => 'localhost', |
39 | 39 | 'port' => 3306, |
40 | 40 | 'user' => 'root', |
41 | 41 | 'password' => '', |
42 | 42 | 'dbname' => 'monarc_common', |
43 | 43 | 'charset' => 'utf8', |
44 | | - 'driverOptions' => array( |
| 44 | + 'driverOptions' => [ |
45 | 45 | PDO::ATTR_STRINGIFY_FETCHES => false, |
46 | 46 | PDO::ATTR_EMULATE_PREPARES => false, |
47 | 47 | PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8', |
48 | | - ), |
49 | | - ), |
50 | | - ), |
51 | | - 'orm_cli' => array( |
| 48 | + ], |
| 49 | + ], |
| 50 | + ], |
| 51 | + 'orm_cli' => [ |
52 | 52 | 'driverClass' => Driver::class, |
53 | | - 'params' => array( |
| 53 | + 'params' => [ |
54 | 54 | 'host' => 'localhost', |
55 | 55 | 'port' => 3306, |
56 | 56 | 'user' => 'root', |
57 | 57 | 'password' => '', |
58 | 58 | 'dbname' => 'monarc_cli', |
59 | 59 | 'charset' => 'utf8', |
60 | | - 'driverOptions' => array( |
| 60 | + 'driverOptions' => [ |
61 | 61 | PDO::ATTR_STRINGIFY_FETCHES => false, |
62 | 62 | PDO::ATTR_EMULATE_PREPARES => false, |
63 | 63 | PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8', |
64 | | - ), |
65 | | - ), |
66 | | - ), |
67 | | - ), |
| 64 | + ], |
| 65 | + ], |
| 66 | + ], |
| 67 | + ], |
68 | 68 | /*'migrations_configuration' => array( |
69 | 69 | 'orm_default' => array( |
70 | 70 | 'name' => 'Monarc Migrations', |
|
81 | 81 | 'column' => 'version', |
82 | 82 | ), |
83 | 83 | ),*/ |
84 | | - 'entitymanager' => array( |
85 | | - 'orm_default' => array( |
86 | | - 'connection' => 'orm_default', |
87 | | - 'configuration' => 'orm_default' |
88 | | - ), |
89 | | - 'orm_cli' => array( |
90 | | - 'connection' => 'orm_cli', |
| 84 | + 'entitymanager' => [ |
| 85 | + 'orm_default' => [ |
| 86 | + 'connection' => 'orm_default', |
| 87 | + 'configuration' => 'orm_default', |
| 88 | + ], |
| 89 | + 'orm_cli' => [ |
| 90 | + 'connection' => 'orm_cli', |
91 | 91 | 'configuration' => 'orm_cli', |
92 | | - ), |
93 | | - ), |
| 92 | + ], |
| 93 | + ], |
94 | 94 | // https://github.com/beberlei/DoctrineExtensions/blob/master/config/mysql.yml |
95 | | - 'configuration' => array( |
96 | | - 'orm_default' => array( |
97 | | - 'metadata_cache' => 'mycache', |
98 | | - 'query_cache' => 'mycache', |
99 | | - 'result_cache' => 'mycache', |
100 | | - 'driver' => 'orm_default', // This driver will be defined later |
101 | | - 'generate_proxies' => true, |
102 | | - 'proxy_dir' => $datapath.'/DoctrineORMModule/Proxy', |
103 | | - 'proxy_namespace' => 'DoctrineORMModule\Proxy', |
104 | | - 'filters' => array(), |
105 | | - 'datetime_functions' => array(), |
106 | | - 'string_functions' => array(), |
107 | | - 'numeric_functions' => array(), |
108 | | - 'second_level_cache' => array(), |
109 | | - 'sql_logger' => 'doctrine.monarc_logger', |
110 | | - ), |
111 | | - 'orm_cli' => array( |
112 | | - 'metadata_cache' => 'mycache', |
113 | | - 'query_cache' => 'mycache', |
114 | | - 'result_cache' => 'mycache', |
115 | | - 'driver' => 'orm_cli', // This driver will be defined later |
116 | | - 'generate_proxies' => true, |
117 | | - 'proxy_dir' => $datapath.'/DoctrineORMModule/Proxy', |
118 | | - 'proxy_namespace' => 'DoctrineORMModule\Proxy', |
119 | | - 'filters' => array(), |
120 | | - 'datetime_functions' => array(), |
121 | | - 'string_functions' => array(), |
122 | | - 'numeric_functions' => array(), |
123 | | - 'second_level_cache' => array(), |
124 | | - 'sql_logger' => 'doctrine.monarc_logger', |
125 | | - ), |
126 | | - ), |
127 | | - ), |
| 95 | + 'configuration' => [ |
| 96 | + 'orm_default' => [ |
| 97 | + 'metadata_cache' => 'mycache', |
| 98 | + 'query_cache' => 'mycache', |
| 99 | + 'result_cache' => 'mycache', |
| 100 | + 'driver' => 'orm_default', // This driver will be defined later |
| 101 | + 'generate_proxies' => true, |
| 102 | + 'proxy_dir' => $dataPath . '/DoctrineORMModule/Proxy', |
| 103 | + 'proxy_namespace' => 'DoctrineORMModule\Proxy', |
| 104 | + 'filters' => [], |
| 105 | + 'datetime_functions' => [], |
| 106 | + 'string_functions' => [], |
| 107 | + 'numeric_functions' => [], |
| 108 | + 'second_level_cache' => [], |
| 109 | + 'sql_logger' => 'doctrine.monarc_logger', |
| 110 | + ], |
| 111 | + 'orm_cli' => [ |
| 112 | + 'metadata_cache' => 'mycache', |
| 113 | + 'query_cache' => 'mycache', |
| 114 | + 'result_cache' => 'mycache', |
| 115 | + 'driver' => 'orm_cli', // This driver will be defined later |
| 116 | + 'generate_proxies' => true, |
| 117 | + 'proxy_dir' => $dataPath . '/DoctrineORMModule/Proxy', |
| 118 | + 'proxy_namespace' => 'DoctrineORMModule\Proxy', |
| 119 | + 'filters' => [], |
| 120 | + 'datetime_functions' => [], |
| 121 | + 'string_functions' => [], |
| 122 | + 'numeric_functions' => [], |
| 123 | + 'second_level_cache' => [], |
| 124 | + 'sql_logger' => 'doctrine.monarc_logger', |
| 125 | + ], |
| 126 | + ], |
| 127 | + ], |
128 | 128 | // END DOCTRINE CONF |
129 | | -); |
| 129 | +]; |
0 commit comments