Added the data path global const to use it in all the places.
parent
8ad3daa8e9
commit
a841068f60
|
@ -5,14 +5,14 @@
|
||||||
*
|
*
|
||||||
* @see https://github.com/zendframework/ZFTool
|
* @see https://github.com/zendframework/ZFTool
|
||||||
*/
|
*/
|
||||||
$env = getenv('APPLICATION_ENV') ?: 'production';
|
$env = getenv('APP_ENV') ?: 'production';
|
||||||
$appConfDir = getenv('APP_CONF_DIR') ?: null;
|
$appConfDir = getenv('APP_CONF_DIR') ?: null;
|
||||||
|
|
||||||
defined('PROJECT_ROOT') or define('PROJECT_ROOT', __DIR__ . '/../');
|
defined('PROJECT_ROOT') or define('PROJECT_ROOT', __DIR__ . '/../');
|
||||||
|
|
||||||
if ($env !== 'testing') {
|
if ($env !== 'testing') {
|
||||||
$confPaths = ['config/autoload/{,*.}{global,local}.php'];
|
$confPaths = ['config/autoload/{,*.}{global,local}.php'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$dataPath = 'data';
|
$dataPath = 'data';
|
||||||
if (!empty($appConfDir)) {
|
if (!empty($appConfDir)) {
|
||||||
$confPaths[] = $appConfDir . '/local.php';
|
$confPaths[] = $appConfDir . '/local.php';
|
||||||
|
@ -25,6 +25,7 @@ if (!empty($appConfDir)) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
defined('DATA_PATH') or define('DATA_PATH', $dataPath);
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'modules' => [
|
'modules' => [
|
||||||
|
|
|
@ -15,56 +15,56 @@ use Doctrine\DBAL\Driver\PDO\MySQL\Driver;
|
||||||
use Monarc\Core\Service\DoctrineCacheServiceFactory;
|
use Monarc\Core\Service\DoctrineCacheServiceFactory;
|
||||||
use Monarc\Core\Service\DoctrineLoggerFactory;
|
use Monarc\Core\Service\DoctrineLoggerFactory;
|
||||||
|
|
||||||
$appconfdir = getenv('APP_CONF_DIR') ?? '';
|
$dataPath = 'data';
|
||||||
|
if (defined('DATA_PATH')) {
|
||||||
$datapath = "data";
|
$dataPath = DATA_PATH;
|
||||||
if (!empty($appconfdir)) {
|
} elseif (getenv('APP_CONF_DIR')) {
|
||||||
$datapath = $appconfdir . '/data';
|
$dataPath = getenv('APP_CONF_DIR') . '/data';
|
||||||
}
|
}
|
||||||
|
|
||||||
return array(
|
return [
|
||||||
// DOCTRINE CONF
|
// DOCTRINE CONF
|
||||||
'service_manager' => array(
|
'service_manager' => [
|
||||||
'factories' => array(
|
'factories' => [
|
||||||
'doctrine.cache.mycache' => DoctrineCacheServiceFactory::class,
|
'doctrine.cache.mycache' => DoctrineCacheServiceFactory::class,
|
||||||
'doctrine.monarc_logger' => DoctrineLoggerFactory::class,
|
'doctrine.monarc_logger' => DoctrineLoggerFactory::class,
|
||||||
),
|
],
|
||||||
),
|
],
|
||||||
'doctrine' => array(
|
'doctrine' => [
|
||||||
'connection' => array(
|
'connection' => [
|
||||||
'orm_default' => array(
|
'orm_default' => [
|
||||||
'driverClass' => Driver::class,
|
'driverClass' => Driver::class,
|
||||||
'params' => array(
|
'params' => [
|
||||||
'host' => 'localhost',
|
'host' => 'localhost',
|
||||||
'port' => 3306,
|
'port' => 3306,
|
||||||
'user' => 'root',
|
'user' => 'root',
|
||||||
'password' => '',
|
'password' => '',
|
||||||
'dbname' => 'monarc_common',
|
'dbname' => 'monarc_common',
|
||||||
'charset' => 'utf8',
|
'charset' => 'utf8',
|
||||||
'driverOptions' => array(
|
'driverOptions' => [
|
||||||
PDO::ATTR_STRINGIFY_FETCHES => false,
|
PDO::ATTR_STRINGIFY_FETCHES => false,
|
||||||
PDO::ATTR_EMULATE_PREPARES => false,
|
PDO::ATTR_EMULATE_PREPARES => false,
|
||||||
PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8',
|
PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8',
|
||||||
),
|
],
|
||||||
),
|
],
|
||||||
),
|
],
|
||||||
'orm_cli' => array(
|
'orm_cli' => [
|
||||||
'driverClass' => Driver::class,
|
'driverClass' => Driver::class,
|
||||||
'params' => array(
|
'params' => [
|
||||||
'host' => 'localhost',
|
'host' => 'localhost',
|
||||||
'port' => 3306,
|
'port' => 3306,
|
||||||
'user' => 'root',
|
'user' => 'root',
|
||||||
'password' => '',
|
'password' => '',
|
||||||
'dbname' => 'monarc_cli',
|
'dbname' => 'monarc_cli',
|
||||||
'charset' => 'utf8',
|
'charset' => 'utf8',
|
||||||
'driverOptions' => array(
|
'driverOptions' => [
|
||||||
PDO::ATTR_STRINGIFY_FETCHES => false,
|
PDO::ATTR_STRINGIFY_FETCHES => false,
|
||||||
PDO::ATTR_EMULATE_PREPARES => false,
|
PDO::ATTR_EMULATE_PREPARES => false,
|
||||||
PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8',
|
PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8',
|
||||||
),
|
],
|
||||||
),
|
],
|
||||||
),
|
],
|
||||||
),
|
],
|
||||||
/*'migrations_configuration' => array(
|
/*'migrations_configuration' => array(
|
||||||
'orm_default' => array(
|
'orm_default' => array(
|
||||||
'name' => 'Monarc Migrations',
|
'name' => 'Monarc Migrations',
|
||||||
|
@ -81,49 +81,49 @@ return array(
|
||||||
'column' => 'version',
|
'column' => 'version',
|
||||||
),
|
),
|
||||||
),*/
|
),*/
|
||||||
'entitymanager' => array(
|
'entitymanager' => [
|
||||||
'orm_default' => array(
|
'orm_default' => [
|
||||||
'connection' => 'orm_default',
|
'connection' => 'orm_default',
|
||||||
'configuration' => 'orm_default'
|
'configuration' => 'orm_default',
|
||||||
),
|
],
|
||||||
'orm_cli' => array(
|
'orm_cli' => [
|
||||||
'connection' => 'orm_cli',
|
'connection' => 'orm_cli',
|
||||||
'configuration' => 'orm_cli',
|
'configuration' => 'orm_cli',
|
||||||
),
|
],
|
||||||
),
|
],
|
||||||
// https://github.com/beberlei/DoctrineExtensions/blob/master/config/mysql.yml
|
// https://github.com/beberlei/DoctrineExtensions/blob/master/config/mysql.yml
|
||||||
'configuration' => array(
|
'configuration' => [
|
||||||
'orm_default' => array(
|
'orm_default' => [
|
||||||
'metadata_cache' => 'mycache',
|
'metadata_cache' => 'mycache',
|
||||||
'query_cache' => 'mycache',
|
'query_cache' => 'mycache',
|
||||||
'result_cache' => 'mycache',
|
'result_cache' => 'mycache',
|
||||||
'driver' => 'orm_default', // This driver will be defined later
|
'driver' => 'orm_default', // This driver will be defined later
|
||||||
'generate_proxies' => true,
|
'generate_proxies' => true,
|
||||||
'proxy_dir' => $datapath.'/DoctrineORMModule/Proxy',
|
'proxy_dir' => $dataPath . '/DoctrineORMModule/Proxy',
|
||||||
'proxy_namespace' => 'DoctrineORMModule\Proxy',
|
'proxy_namespace' => 'DoctrineORMModule\Proxy',
|
||||||
'filters' => array(),
|
'filters' => [],
|
||||||
'datetime_functions' => array(),
|
'datetime_functions' => [],
|
||||||
'string_functions' => array(),
|
'string_functions' => [],
|
||||||
'numeric_functions' => array(),
|
'numeric_functions' => [],
|
||||||
'second_level_cache' => array(),
|
'second_level_cache' => [],
|
||||||
'sql_logger' => 'doctrine.monarc_logger',
|
'sql_logger' => 'doctrine.monarc_logger',
|
||||||
),
|
],
|
||||||
'orm_cli' => array(
|
'orm_cli' => [
|
||||||
'metadata_cache' => 'mycache',
|
'metadata_cache' => 'mycache',
|
||||||
'query_cache' => 'mycache',
|
'query_cache' => 'mycache',
|
||||||
'result_cache' => 'mycache',
|
'result_cache' => 'mycache',
|
||||||
'driver' => 'orm_cli', // This driver will be defined later
|
'driver' => 'orm_cli', // This driver will be defined later
|
||||||
'generate_proxies' => true,
|
'generate_proxies' => true,
|
||||||
'proxy_dir' => $datapath.'/DoctrineORMModule/Proxy',
|
'proxy_dir' => $dataPath . '/DoctrineORMModule/Proxy',
|
||||||
'proxy_namespace' => 'DoctrineORMModule\Proxy',
|
'proxy_namespace' => 'DoctrineORMModule\Proxy',
|
||||||
'filters' => array(),
|
'filters' => [],
|
||||||
'datetime_functions' => array(),
|
'datetime_functions' => [],
|
||||||
'string_functions' => array(),
|
'string_functions' => [],
|
||||||
'numeric_functions' => array(),
|
'numeric_functions' => [],
|
||||||
'second_level_cache' => array(),
|
'second_level_cache' => [],
|
||||||
'sql_logger' => 'doctrine.monarc_logger',
|
'sql_logger' => 'doctrine.monarc_logger',
|
||||||
),
|
],
|
||||||
),
|
],
|
||||||
),
|
],
|
||||||
// END DOCTRINE CONF
|
// END DOCTRINE CONF
|
||||||
);
|
];
|
||||||
|
|
Loading…
Reference in New Issue