1
|
|
|
<?php |
2
|
|
|
declare(strict_types=1); |
3
|
|
|
|
4
|
|
|
|
5
|
|
|
namespace Xervice\Database; |
6
|
|
|
|
7
|
|
|
|
8
|
|
|
use Xervice\Config\Business\XerviceConfig; |
9
|
|
|
use Xervice\Core\Business\Model\Config\AbstractConfig; |
10
|
|
|
|
11
|
|
|
class DatabaseConfig extends AbstractConfig |
12
|
|
|
{ |
13
|
|
|
public const PROPEL = 'propel'; |
14
|
|
|
public const PROPEL_CONF_DIR = 'propel.conf.dir'; |
15
|
|
|
public const PROPEL_CONF_ADAPTER = 'propel.conf.adapter'; |
16
|
|
|
public const PROPEL_CONF_HOST = 'propel.conf.host'; |
17
|
|
|
public const PROPEL_CONF_PORT = 'propel.conf.port'; |
18
|
|
|
public const PROPEL_CONF_DBNAME = 'propel.conf.dbname'; |
19
|
|
|
public const PROPEL_CONF_USER = 'propel.conf.user'; |
20
|
|
|
public const PROPEL_CONF_PASSWORD = 'propel.conf.password'; |
21
|
|
|
public const PROPEL_COMMAND = 'propel.command'; |
22
|
|
|
public const SCHEMA_PATHS = 'propel.schema.path'; |
23
|
|
|
public const SCHEMA_TARGET = 'propel.schema.target'; |
24
|
|
|
public const SCHEMA_PATTERN = 'propel.schema.pattern'; |
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* @return string |
28
|
|
|
*/ |
29
|
1 |
|
public function getSchemaPattern(): string |
30
|
|
|
{ |
31
|
1 |
|
return $this->get(self::SCHEMA_PATTERN, '.schema.xml'); |
32
|
|
|
} |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* @return string |
36
|
|
|
*/ |
37
|
1 |
|
public function getSchemaTarget(): string |
38
|
|
|
{ |
39
|
1 |
|
return $this->get(self::SCHEMA_TARGET, ''); |
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* @return array |
44
|
|
|
*/ |
45
|
1 |
|
public function getSchemaPaths(): array |
46
|
|
|
{ |
47
|
1 |
|
return $this->get(self::SCHEMA_PATHS, []); |
48
|
|
|
} |
49
|
|
|
|
50
|
|
|
/** |
51
|
|
|
* @return array |
52
|
|
|
*/ |
53
|
2 |
|
public function getPropelConfig() : array |
54
|
|
|
{ |
55
|
2 |
|
return $this->get(self::PROPEL); |
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
/** |
59
|
|
|
* @return string |
60
|
|
|
*/ |
61
|
3 |
|
public function getConfDir() : string |
62
|
|
|
{ |
63
|
3 |
|
return $this->get(self::PROPEL_CONF_DIR); |
64
|
|
|
} |
65
|
|
|
|
66
|
|
|
/** |
67
|
|
|
* @return string |
68
|
|
|
*/ |
69
|
2 |
|
public function getPropelCommand() : string |
70
|
|
|
{ |
71
|
2 |
|
return $this->get(self::PROPEL_COMMAND, 'vendor/bin/propel'); |
72
|
|
|
} |
73
|
|
|
|
74
|
|
|
/** |
75
|
|
|
* @return string |
76
|
|
|
*/ |
77
|
2 |
|
public function getApplicationPath(): string |
78
|
|
|
{ |
79
|
2 |
|
return $this->get(XerviceConfig::APPLICATION_PATH); |
80
|
|
|
} |
81
|
|
|
} |
82
|
|
|
|