1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace Doctrine\ORM\Mapping; |
6
|
|
|
|
7
|
|
|
use Doctrine\ORM\Reflection\ReflectionService; |
8
|
|
|
use ReflectionProperty; |
9
|
|
|
|
10
|
|
|
class FieldMetadata extends LocalColumnMetadata implements Property |
11
|
|
|
{ |
12
|
|
|
/** @var ComponentMetadata */ |
13
|
|
|
protected $declaringClass; |
14
|
|
|
|
15
|
|
|
/** @var ReflectionProperty */ |
16
|
|
|
protected $reflection; |
17
|
|
|
|
18
|
|
|
/** @var string */ |
19
|
|
|
protected $name; |
20
|
|
|
|
21
|
|
|
/** @var bool */ |
22
|
|
|
protected $versioned = false; |
23
|
|
|
|
24
|
413 |
|
public function __construct(string $name/*, string $columnName, Type $type*/) |
25
|
|
|
{ |
26
|
|
|
// @todo Leverage this implementation instead of default, simple constructor |
27
|
|
|
// parent::__construct($columnName, $type); |
28
|
413 |
|
$this->name = $name; |
29
|
413 |
|
} |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* {@inheritdoc} |
33
|
|
|
*/ |
34
|
807 |
|
public function getDeclaringClass() : ComponentMetadata |
35
|
|
|
{ |
36
|
807 |
|
return $this->declaringClass; |
37
|
|
|
} |
38
|
|
|
|
39
|
412 |
|
public function setDeclaringClass(ComponentMetadata $declaringClass) : void |
40
|
|
|
{ |
41
|
412 |
|
$this->declaringClass = $declaringClass; |
42
|
412 |
|
} |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* {@inheritdoc} |
46
|
|
|
*/ |
47
|
897 |
|
public function getName() : string |
48
|
|
|
{ |
49
|
897 |
|
return $this->name; |
50
|
|
|
} |
51
|
|
|
|
52
|
1265 |
|
public function isVersioned() : bool |
53
|
|
|
{ |
54
|
1265 |
|
return $this->versioned; |
55
|
|
|
} |
56
|
|
|
|
57
|
400 |
|
public function setVersioned(bool $versioned) : void |
58
|
|
|
{ |
59
|
400 |
|
$this->versioned = $versioned; |
60
|
400 |
|
} |
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* {@inheritdoc} |
64
|
|
|
*/ |
65
|
1062 |
|
public function setValue($object, $value) : void |
66
|
|
|
{ |
67
|
1062 |
|
$this->reflection->setValue($object, $value); |
68
|
1062 |
|
} |
69
|
|
|
|
70
|
|
|
/** |
71
|
|
|
* {@inheritdoc} |
72
|
|
|
*/ |
73
|
1073 |
|
public function getValue($object) |
74
|
|
|
{ |
75
|
1073 |
|
return $this->reflection->getValue($object); |
76
|
|
|
} |
77
|
|
|
|
78
|
|
|
/** |
79
|
|
|
* {@inheritdoc} |
80
|
|
|
*/ |
81
|
|
|
public function isAssociation() : bool |
82
|
|
|
{ |
83
|
|
|
return false; |
84
|
|
|
} |
85
|
|
|
|
86
|
|
|
/** |
87
|
|
|
* {@inheritdoc} |
88
|
|
|
*/ |
89
|
|
|
public function isField() : bool |
90
|
|
|
{ |
91
|
|
|
return true; |
92
|
|
|
} |
93
|
|
|
|
94
|
|
|
/** |
95
|
|
|
* {@inheritdoc} |
96
|
|
|
*/ |
97
|
1993 |
|
public function setReflectionProperty(ReflectionProperty $reflectionProperty) : void |
98
|
|
|
{ |
99
|
1993 |
|
$this->reflection = $reflectionProperty; |
100
|
1993 |
|
} |
101
|
|
|
|
102
|
|
|
/** |
103
|
|
|
* {@inheritdoc} |
104
|
|
|
*/ |
105
|
1632 |
|
public function wakeupReflection(ReflectionService $reflectionService) : void |
106
|
|
|
{ |
107
|
1632 |
|
$this->setReflectionProperty( |
108
|
1632 |
|
$reflectionService->getAccessibleProperty($this->declaringClass->getClassName(), $this->name) |
|
|
|
|
109
|
|
|
); |
110
|
1632 |
|
} |
111
|
|
|
} |
112
|
|
|
|