1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
|
4
|
|
|
declare(strict_types=1); |
5
|
|
|
|
6
|
|
|
namespace Doctrine\ORM\Mapping; |
7
|
|
|
|
8
|
|
|
/** |
9
|
|
|
* Class MappedSuperClassMetadata |
10
|
|
|
* |
11
|
|
|
* @package Doctrine\ORM\Mapping |
12
|
|
|
* @since 3.0 |
13
|
|
|
* |
14
|
|
|
* @author Guilherme Blanco <[email protected]> |
15
|
|
|
*/ |
16
|
|
|
class MappedSuperClassMetadata extends ComponentMetadata |
17
|
|
|
{ |
18
|
|
|
/** |
19
|
|
|
* @var null|string |
20
|
|
|
*/ |
21
|
|
|
protected $customRepositoryClassName; |
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* @var null|Property |
25
|
|
|
*/ |
26
|
|
|
protected $declaredVersion; |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* @return null|string |
30
|
|
|
*/ |
31
|
|
|
public function getCustomRepositoryClassName() : ?string |
32
|
|
|
{ |
33
|
|
|
return $this->customRepositoryClassName; |
34
|
|
|
} |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* @param null|string customRepositoryClassName |
38
|
|
|
*/ |
39
|
|
|
public function setCustomRepositoryClassName(?string $customRepositoryClassName) : void |
40
|
|
|
{ |
41
|
|
|
$this->customRepositoryClassName = $customRepositoryClassName; |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* @return Property|null |
46
|
|
|
*/ |
47
|
|
|
public function getDeclaredVersion() : ?Property |
48
|
|
|
{ |
49
|
|
|
return $this->declaredVersion; |
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* @param Property $property |
54
|
|
|
*/ |
55
|
|
|
public function setDeclaredVersion(Property $property) : void |
56
|
|
|
{ |
57
|
|
|
$this->declaredVersion = $property; |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* @return Property|null |
62
|
|
|
*/ |
63
|
|
|
public function getVersion() : ?Property |
64
|
|
|
{ |
65
|
|
|
/** @var MappedSuperClassMetadata|null $parent */ |
66
|
|
|
$parent = $this->parent; |
67
|
|
|
$version = $this->declaredVersion; |
68
|
|
|
|
69
|
|
|
if ($parent && ! $version) { |
70
|
|
|
$version = $parent->getVersion(); |
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
return $version; |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
/** |
77
|
|
|
* @return bool |
78
|
|
|
*/ |
79
|
|
|
public function isVersioned() : bool |
80
|
|
|
{ |
81
|
|
|
return $this->getVersion() !== null; |
82
|
|
|
} |
83
|
|
|
|
84
|
|
|
/** |
85
|
|
|
* {@inheritdoc} |
86
|
|
|
*/ |
87
|
|
|
public function addDeclaredProperty(Property $property) : void |
88
|
|
|
{ |
89
|
|
|
parent::addDeclaredProperty($property); |
90
|
|
|
|
91
|
|
|
if ($property instanceof VersionFieldMetadata) { |
92
|
|
|
$this->setDeclaredVersion($property); |
93
|
|
|
} |
94
|
|
|
} |
95
|
|
|
} |
96
|
|
|
|