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