|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace Doctrine\ORM\Configuration; |
|
6
|
|
|
|
|
7
|
|
|
use Doctrine\DBAL\Platforms\AbstractPlatform; |
|
8
|
|
|
use Doctrine\ORM\Mapping\Driver\MappingDriver; |
|
9
|
|
|
use Doctrine\ORM\Mapping\Factory\AbstractClassMetadataFactory; |
|
10
|
|
|
use Doctrine\ORM\Mapping\Factory\ClassMetadataResolver; |
|
11
|
|
|
use Doctrine\ORM\Mapping\Factory\DefaultNamingStrategy; |
|
12
|
|
|
use Doctrine\ORM\Mapping\Factory\NamingStrategy; |
|
13
|
|
|
use const DIRECTORY_SEPARATOR; |
|
14
|
|
|
use function ltrim; |
|
15
|
|
|
use function rtrim; |
|
16
|
|
|
|
|
17
|
|
|
/** |
|
18
|
|
|
* Configuration container for class metadata options of Doctrine. |
|
19
|
|
|
*/ |
|
20
|
|
|
class MetadataConfiguration |
|
21
|
|
|
{ |
|
22
|
|
|
/** @var string */ |
|
23
|
|
|
private $namespace; |
|
24
|
|
|
|
|
25
|
|
|
/** @var string */ |
|
26
|
|
|
private $directory; |
|
27
|
|
|
|
|
28
|
|
|
/** @var ClassMetadataResolver */ |
|
29
|
|
|
private $resolver; |
|
30
|
|
|
|
|
31
|
|
|
/** @var MappingDriver */ |
|
32
|
|
|
private $mappingDriver; |
|
33
|
|
|
|
|
34
|
|
|
/** @var AbstractPlatform */ |
|
35
|
|
|
private $targetPlatform; |
|
36
|
|
|
|
|
37
|
|
|
/** @var NamingStrategy */ |
|
38
|
|
|
private $namingStrategy; |
|
39
|
|
|
|
|
40
|
|
|
/** @var int */ |
|
41
|
|
|
private $autoGenerate = AbstractClassMetadataFactory::AUTOGENERATE_ALWAYS; |
|
42
|
|
|
|
|
43
|
|
|
public function getNamespace() : string |
|
44
|
|
|
{ |
|
45
|
|
|
return $this->namespace; |
|
46
|
|
|
} |
|
47
|
|
|
|
|
48
|
|
|
public function setNamespace(string $namespace) |
|
49
|
|
|
{ |
|
50
|
|
|
$this->namespace = ltrim($namespace, '\\'); |
|
51
|
|
|
} |
|
52
|
|
|
|
|
53
|
|
|
public function getDirectory() : string |
|
54
|
|
|
{ |
|
55
|
|
|
return $this->directory; |
|
56
|
|
|
} |
|
57
|
|
|
|
|
58
|
|
|
public function setDirectory(string $directory) |
|
59
|
|
|
{ |
|
60
|
|
|
$this->directory = rtrim($directory, DIRECTORY_SEPARATOR); |
|
61
|
|
|
} |
|
62
|
|
|
|
|
63
|
|
|
public function getResolver() : ClassMetadataResolver |
|
64
|
|
|
{ |
|
65
|
|
|
return $this->resolver; |
|
66
|
|
|
} |
|
67
|
|
|
|
|
68
|
|
|
public function setResolver(ClassMetadataResolver $resolver) |
|
69
|
|
|
{ |
|
70
|
|
|
$this->resolver = $resolver; |
|
71
|
|
|
} |
|
72
|
|
|
|
|
73
|
|
|
public function getMappingDriver() : MappingDriver |
|
74
|
|
|
{ |
|
75
|
|
|
return $this->mappingDriver; |
|
76
|
|
|
} |
|
77
|
|
|
|
|
78
|
|
|
public function setMappingDriver(MappingDriver $mappingDriver) |
|
79
|
|
|
{ |
|
80
|
|
|
$this->mappingDriver = $mappingDriver; |
|
81
|
|
|
} |
|
82
|
|
|
|
|
83
|
|
|
public function getTargetPlatform() : AbstractPlatform |
|
84
|
|
|
{ |
|
85
|
|
|
return $this->targetPlatform; |
|
86
|
|
|
} |
|
87
|
|
|
|
|
88
|
|
|
public function setTargetPlatform(AbstractPlatform $targetPlatform) : void |
|
89
|
|
|
{ |
|
90
|
|
|
$this->targetPlatform = $targetPlatform; |
|
91
|
|
|
} |
|
92
|
|
|
|
|
93
|
|
|
public function getNamingStrategy() : NamingStrategy |
|
94
|
|
|
{ |
|
95
|
|
|
if (! $this->namingStrategy) { |
|
96
|
|
|
$this->namingStrategy = new DefaultNamingStrategy(); |
|
97
|
|
|
} |
|
98
|
|
|
|
|
99
|
|
|
return $this->namingStrategy; |
|
100
|
|
|
} |
|
101
|
|
|
|
|
102
|
|
|
public function setNamingStrategy(NamingStrategy $namingStrategy) |
|
103
|
|
|
{ |
|
104
|
|
|
$this->namingStrategy = $namingStrategy; |
|
105
|
|
|
} |
|
106
|
|
|
|
|
107
|
|
|
public function getAutoGenerate() : int |
|
108
|
|
|
{ |
|
109
|
|
|
return $this->autoGenerate; |
|
110
|
|
|
} |
|
111
|
|
|
|
|
112
|
|
|
public function setAutoGenerate(int $autoGenerate) |
|
113
|
|
|
{ |
|
114
|
|
|
$this->autoGenerate = $autoGenerate; |
|
115
|
|
|
} |
|
116
|
|
|
} |
|
117
|
|
|
|