1 | <?php |
||
17 | class ScalarBeanPropertyDescriptor extends AbstractBeanPropertyDescriptor |
||
18 | { |
||
19 | /** |
||
20 | * @var Column |
||
21 | */ |
||
22 | private $column; |
||
23 | |||
24 | /** |
||
25 | * @var Annotations |
||
26 | */ |
||
27 | private $annotations; |
||
28 | |||
29 | /** |
||
30 | * ScalarBeanPropertyDescriptor constructor. |
||
31 | * @param Table $table |
||
32 | * @param Column $column |
||
33 | * @param NamingStrategyInterface $namingStrategy |
||
34 | */ |
||
35 | public function __construct(Table $table, Column $column, NamingStrategyInterface $namingStrategy) |
||
41 | |||
42 | /** |
||
43 | * Returns the foreign-key the column is part of, if any. null otherwise. |
||
44 | * |
||
45 | * @return ForeignKeyConstraint|null |
||
46 | */ |
||
47 | public function getForeignKey() |
||
51 | |||
52 | /** |
||
53 | * Returns the param annotation for this property (useful for constructor). |
||
54 | * |
||
55 | * @return string |
||
56 | */ |
||
57 | public function getParamAnnotation() |
||
65 | |||
66 | /** |
||
67 | * Returns the name of the class linked to this property or null if this is not a foreign key. |
||
68 | * |
||
69 | * @return null|string |
||
70 | */ |
||
71 | public function getClassName(): ?string |
||
75 | |||
76 | /** |
||
77 | * Returns the PHP type for the property (it can be a scalar like int, bool, or class names, like \DateTimeInterface, App\Bean\User....) |
||
78 | * |
||
79 | * @return string |
||
80 | */ |
||
81 | public function getPhpType(): string |
||
86 | |||
87 | /** |
||
88 | * Returns true if the property is compulsory (and therefore should be fetched in the constructor). |
||
89 | * |
||
90 | * @return bool |
||
91 | */ |
||
92 | public function isCompulsory() |
||
96 | |||
97 | private function isAutoincrement() : bool |
||
101 | |||
102 | private function hasUuidAnnotation(): bool |
||
106 | |||
107 | private function getUuidAnnotation(): ?Annotation |
||
111 | |||
112 | private function getAutoincrementAnnotation(): ?Annotation |
||
116 | |||
117 | private function getAnnotations(): Annotations |
||
129 | |||
130 | /** |
||
131 | * Returns true if the property has a default value (or if the @UUID annotation is set for the column) |
||
132 | * |
||
133 | * @return bool |
||
134 | */ |
||
135 | public function hasDefault() |
||
139 | |||
140 | /** |
||
141 | * Returns the code that assigns a value to its default value. |
||
142 | * |
||
143 | * @return string |
||
144 | */ |
||
145 | public function assignToDefaultCode() |
||
175 | |||
176 | /** |
||
177 | * Returns true if the property is the primary key. |
||
178 | * |
||
179 | * @return bool |
||
180 | */ |
||
181 | public function isPrimaryKey() |
||
185 | |||
186 | /** |
||
187 | * Returns the PHP code for getters and setters. |
||
188 | * |
||
189 | * @return string |
||
190 | */ |
||
191 | public function getGetterSetterCode() |
||
246 | |||
247 | /** |
||
248 | * Returns the part of code useful when doing json serialization. |
||
249 | * |
||
250 | * @return string |
||
251 | */ |
||
252 | public function getJsonSerializeCode() |
||
262 | |||
263 | /** |
||
264 | * Returns the column name. |
||
265 | * |
||
266 | * @return string |
||
267 | */ |
||
268 | public function getColumnName() |
||
272 | } |
||
273 |