1
|
|
|
<?php declare(strict_types=1); |
2
|
|
|
/** |
3
|
|
|
* Spiral Framework. |
4
|
|
|
* |
5
|
|
|
* @license MIT |
6
|
|
|
* @author Anton Titov (Wolfy-J) |
7
|
|
|
*/ |
8
|
|
|
|
9
|
|
|
namespace Cycle\Annotated\Annotation; |
10
|
|
|
|
11
|
|
|
use Spiral\Annotations\AbstractAnnotation; |
12
|
|
|
use Spiral\Annotations\Parser; |
13
|
|
|
|
14
|
|
|
final class Entity extends AbstractAnnotation |
15
|
|
|
{ |
16
|
|
|
public const NAME = 'entity'; |
17
|
|
|
public const SCHEMA = [ |
18
|
|
|
'role' => Parser::STRING, |
19
|
|
|
'mapper' => Parser::STRING, |
20
|
|
|
'repository' => Parser::STRING, |
21
|
|
|
'table' => Parser::STRING, |
22
|
|
|
'database' => Parser::STRING, |
23
|
|
|
'readonlySchema' => Parser::BOOL, |
24
|
|
|
'source' => Parser::STRING, |
25
|
|
|
'constrain' => Parser::STRING |
26
|
|
|
]; |
27
|
|
|
|
28
|
|
|
/** @var string|null */ |
29
|
|
|
protected $role; |
30
|
|
|
|
31
|
|
|
/** @var string|null */ |
32
|
|
|
protected $mapper; |
33
|
|
|
|
34
|
|
|
/** @var string|null */ |
35
|
|
|
protected $repository; |
36
|
|
|
|
37
|
|
|
/** @var string|null */ |
38
|
|
|
protected $table; |
39
|
|
|
|
40
|
|
|
/** @var bool */ |
41
|
|
|
protected $readonlySchema = false; |
42
|
|
|
|
43
|
|
|
/** @var string|null */ |
44
|
|
|
protected $database; |
45
|
|
|
|
46
|
|
|
/** @var string|null */ |
47
|
|
|
protected $source; |
48
|
|
|
|
49
|
|
|
/** @var string|null */ |
50
|
|
|
protected $constrain; |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* @return string|null |
54
|
|
|
*/ |
55
|
|
|
public function getRole(): ?string |
56
|
|
|
{ |
57
|
|
|
return $this->role; |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* @return string|null |
62
|
|
|
*/ |
63
|
|
|
public function getMapper(): ?string |
64
|
|
|
{ |
65
|
|
|
return $this->mapper; |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
/** |
69
|
|
|
* @return string|null |
70
|
|
|
*/ |
71
|
|
|
public function getRepository(): ?string |
72
|
|
|
{ |
73
|
|
|
return $this->repository; |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
/** |
77
|
|
|
* @return string|null |
78
|
|
|
*/ |
79
|
|
|
public function getTable(): ?string |
80
|
|
|
{ |
81
|
|
|
return $this->table; |
82
|
|
|
} |
83
|
|
|
|
84
|
|
|
/** |
85
|
|
|
* @return bool |
86
|
|
|
*/ |
87
|
|
|
public function isReadonlySchema(): bool |
88
|
|
|
{ |
89
|
|
|
return $this->readonlySchema; |
90
|
|
|
} |
91
|
|
|
|
92
|
|
|
/** |
93
|
|
|
* @return string|null |
94
|
|
|
*/ |
95
|
|
|
public function getDatabase(): ?string |
96
|
|
|
{ |
97
|
|
|
return $this->database; |
98
|
|
|
} |
99
|
|
|
|
100
|
|
|
/** |
101
|
|
|
* @return string|null |
102
|
|
|
*/ |
103
|
|
|
public function getSource(): ?string |
104
|
|
|
{ |
105
|
|
|
return $this->source; |
106
|
|
|
} |
107
|
|
|
|
108
|
|
|
/** |
109
|
|
|
* @return string|null |
110
|
|
|
*/ |
111
|
|
|
public function getConstrain(): ?string |
112
|
|
|
{ |
113
|
|
|
return $this->constrain; |
114
|
|
|
} |
115
|
|
|
} |