1 | <?php |
||
4 | class Metadata |
||
5 | { |
||
6 | /** @var string */ |
||
7 | protected $connection; |
||
8 | |||
9 | /** @var string */ |
||
10 | protected $table; |
||
11 | |||
12 | /** @var string */ |
||
13 | protected $class; |
||
14 | |||
15 | /** @var array */ |
||
16 | protected $columns = []; |
||
17 | |||
18 | /** @var array */ |
||
19 | protected $casts = []; |
||
20 | |||
21 | /** @var \Wandu\Database\Annotations\RelationInterface[] */ |
||
22 | protected $relations = []; |
||
23 | |||
24 | /** @var string */ |
||
25 | protected $primaryKey = 'id'; |
||
26 | |||
27 | /** @var bool */ |
||
28 | protected $increments = true; |
||
29 | |||
30 | /** |
||
31 | * @example |
||
32 | * [ |
||
33 | * 'class' => RepositoryTestActor::class, |
||
34 | * 'table' => 'actor', |
||
35 | * 'columns' => [ |
||
36 | * 'id' => 'act_id', |
||
37 | * 'firstName' => 'first_name', |
||
38 | * 'lastName' => 'last_name', |
||
39 | * 'lastUpdate' => 'last_update', |
||
40 | * ], |
||
41 | * 'primaryKey' => 'id', |
||
42 | * 'increments' => true, |
||
43 | * ] |
||
44 | * @param string $table |
||
45 | * @param array $settings |
||
46 | */ |
||
47 | 17 | public function __construct($table, array $settings = []) |
|
54 | |||
55 | /** |
||
56 | * @return string |
||
57 | */ |
||
58 | 14 | public function getConnection(): string |
|
62 | |||
63 | /** |
||
64 | * @return string |
||
65 | */ |
||
66 | 14 | public function getTable() |
|
70 | |||
71 | /** |
||
72 | * @return string |
||
73 | */ |
||
74 | 15 | public function getClass() |
|
78 | |||
79 | /** |
||
80 | * @return array |
||
81 | */ |
||
82 | 14 | public function getColumns() |
|
86 | |||
87 | /** |
||
88 | * @return \Wandu\Database\Annotations\RelationInterface[] |
||
89 | */ |
||
90 | 13 | public function getRelations(): array |
|
94 | |||
95 | /** |
||
96 | * @return string |
||
97 | */ |
||
98 | 5 | public function getPrimaryKey() |
|
102 | |||
103 | /** |
||
104 | * @return boolean |
||
105 | */ |
||
106 | 3 | public function isIncrements() |
|
110 | |||
111 | /** |
||
112 | * @return array |
||
113 | */ |
||
114 | 13 | public function getCasts() |
|
118 | |||
119 | /** |
||
120 | * @return string |
||
121 | */ |
||
122 | 2 | public function getPrimaryProperty() |
|
130 | } |
||
131 |