1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
/* |
6
|
|
|
* This file is part of the Sonata Project package. |
7
|
|
|
* |
8
|
|
|
* (c) Thomas Rabaix <[email protected]> |
9
|
|
|
* |
10
|
|
|
* For the full copyright and license information, please view the LICENSE |
11
|
|
|
* file that was distributed with this source code. |
12
|
|
|
*/ |
13
|
|
|
|
14
|
|
|
namespace Sonata\AdminBundle\Admin; |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* @author Thomas Rabaix <[email protected]> |
18
|
|
|
*/ |
19
|
|
|
interface FieldDescriptionInterface |
20
|
|
|
{ |
21
|
|
|
/** |
22
|
|
|
* set the field name. |
23
|
|
|
*/ |
24
|
|
|
public function setFieldName(?string $fieldName): void; |
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* Returns the field name. |
28
|
|
|
* |
29
|
|
|
* @return string the field name |
30
|
|
|
*/ |
31
|
|
|
public function getFieldName(): ?string; |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* Set the name. |
35
|
|
|
*/ |
36
|
|
|
public function setName(?string $name): void; |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* Returns the name, the name can be used as a form label or table header. |
40
|
|
|
* |
41
|
|
|
* @return string the name |
42
|
|
|
*/ |
43
|
|
|
public function getName(): ?string; |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* Returns the value represented by the provided name. |
47
|
|
|
* |
48
|
|
|
* @param mixed|null $default |
49
|
|
|
* |
50
|
|
|
* @return mixed the value represented by the provided name |
51
|
|
|
*/ |
52
|
|
|
public function getOption(string $name, $default = null); |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* Define an option, an option is has a name and a value. |
56
|
|
|
* |
57
|
|
|
* @param mixed $value |
58
|
|
|
*/ |
59
|
|
|
public function setOption(string $name, $value): void; |
60
|
|
|
|
61
|
|
|
/** |
62
|
|
|
* Define the options value, if the options array contains the reserved keywords |
63
|
|
|
* - type |
64
|
|
|
* - template. |
65
|
|
|
* |
66
|
|
|
* Then the value are copied across to the related property value. |
67
|
|
|
* |
68
|
|
|
* @param array<string, mixed> $options |
69
|
|
|
*/ |
70
|
|
|
public function setOptions(array $options): void; |
71
|
|
|
|
72
|
|
|
/** |
73
|
|
|
* Returns options. |
74
|
|
|
* |
75
|
|
|
* @return array<string, mixed> |
|
|
|
|
76
|
|
|
*/ |
77
|
|
|
public function getOptions(): array; |
78
|
|
|
|
79
|
|
|
/** |
80
|
|
|
* Sets the template used to render the field. |
81
|
|
|
*/ |
82
|
|
|
public function setTemplate(?string $template): void; |
83
|
|
|
|
84
|
|
|
/** |
85
|
|
|
* Returns the template name. |
86
|
|
|
* |
87
|
|
|
* @return string|null the template name |
88
|
|
|
*/ |
89
|
|
|
public function getTemplate(): ?string; |
90
|
|
|
|
91
|
|
|
/** |
92
|
|
|
* Sets the field type. The type is a mandatory field as it's used to select the correct template |
93
|
|
|
* or the logic associated to the current FieldDescription object. |
94
|
|
|
*/ |
95
|
|
|
public function setType(?string $type): void; |
96
|
|
|
|
97
|
|
|
/** |
98
|
|
|
* Returns the type. |
99
|
|
|
*/ |
100
|
|
|
public function getType(): ?string; |
101
|
|
|
|
102
|
|
|
/** |
103
|
|
|
* set the parent Admin (only used in nested admin). |
104
|
|
|
*/ |
105
|
|
|
public function setParent(AdminInterface $parent); |
106
|
|
|
|
107
|
|
|
/** |
108
|
|
|
* Returns the parent Admin (only used in nested admin). |
109
|
|
|
*/ |
110
|
|
|
public function getParent(): AdminInterface; |
111
|
|
|
|
112
|
|
|
public function hasParent(): bool; |
113
|
|
|
|
114
|
|
|
/** |
115
|
|
|
* Define the association mapping definition. |
116
|
|
|
*/ |
117
|
|
|
public function setAssociationMapping(array $associationMapping): void; |
118
|
|
|
|
119
|
|
|
/** |
120
|
|
|
* Returns the association mapping definition. |
121
|
|
|
*/ |
122
|
|
|
public function getAssociationMapping(): array; |
123
|
|
|
|
124
|
|
|
/** |
125
|
|
|
* Returns the related Target object model. |
126
|
|
|
*/ |
127
|
|
|
public function getTargetModel(): ?string; |
128
|
|
|
|
129
|
|
|
/** |
130
|
|
|
* Sets the field mapping information. |
131
|
|
|
*/ |
132
|
|
|
public function setFieldMapping(array $fieldMapping): void; |
133
|
|
|
|
134
|
|
|
/** |
135
|
|
|
* Returns the field mapping definition. |
136
|
|
|
* |
137
|
|
|
* @return array the field mapping definition |
138
|
|
|
*/ |
139
|
|
|
public function getFieldMapping(): array; |
140
|
|
|
|
141
|
|
|
/** |
142
|
|
|
* set the parent association mappings information. |
143
|
|
|
*/ |
144
|
|
|
public function setParentAssociationMappings(array $parentAssociationMappings): void; |
145
|
|
|
|
146
|
|
|
/** |
147
|
|
|
* Returns the parent association mapping definitions. |
148
|
|
|
* |
149
|
|
|
* @return array the parent association mapping definitions |
150
|
|
|
*/ |
151
|
|
|
public function getParentAssociationMappings(): array; |
152
|
|
|
|
153
|
|
|
/** |
154
|
|
|
* set the association admin instance (only used if the field is linked to an Admin). |
155
|
|
|
* |
156
|
|
|
* @param AdminInterface $associationAdmin the associated admin |
157
|
|
|
*/ |
158
|
|
|
public function setAssociationAdmin(AdminInterface $associationAdmin); |
159
|
|
|
|
160
|
|
|
/** |
161
|
|
|
* Returns the associated Admin instance (only used if the field is linked to an Admin). |
162
|
|
|
*/ |
163
|
|
|
public function getAssociationAdmin(): AdminInterface; |
164
|
|
|
|
165
|
|
|
public function hasAssociationAdmin(): bool; |
166
|
|
|
|
167
|
|
|
/** |
168
|
|
|
* Returns true if the FieldDescription is linked to an identifier field. |
169
|
|
|
*/ |
170
|
|
|
public function isIdentifier(): bool; |
171
|
|
|
|
172
|
|
|
/** |
173
|
|
|
* Returns the value linked to the description. |
174
|
|
|
* |
175
|
|
|
* @return bool|mixed |
176
|
|
|
*/ |
177
|
|
|
public function getValue(object $object); |
178
|
|
|
|
179
|
|
|
/** |
180
|
|
|
* set the admin class linked to this FieldDescription. |
181
|
|
|
*/ |
182
|
|
|
public function setAdmin(AdminInterface $admin); |
183
|
|
|
|
184
|
|
|
/** |
185
|
|
|
* @return AdminInterface the admin class linked to this FieldDescription |
186
|
|
|
*/ |
187
|
|
|
public function getAdmin(): AdminInterface; |
188
|
|
|
|
189
|
|
|
public function hasAdmin(): bool; |
190
|
|
|
|
191
|
|
|
/** |
192
|
|
|
* merge option values related to the provided option name. |
193
|
|
|
* |
194
|
|
|
* @throws \RuntimeException |
195
|
|
|
*/ |
196
|
|
|
public function mergeOption(string $name, array $options = []): void; |
197
|
|
|
|
198
|
|
|
/** |
199
|
|
|
* merge options values. |
200
|
|
|
*/ |
201
|
|
|
public function mergeOptions(array $options = []): void; |
202
|
|
|
|
203
|
|
|
/** |
204
|
|
|
* set the original mapping type (only used if the field is linked to an entity). |
205
|
|
|
* |
206
|
|
|
* @param string|int $mappingType |
207
|
|
|
*/ |
208
|
|
|
public function setMappingType($mappingType); |
209
|
|
|
|
210
|
|
|
/** |
211
|
|
|
* Returns the mapping type. |
212
|
|
|
* |
213
|
|
|
* @return int|string |
214
|
|
|
*/ |
215
|
|
|
public function getMappingType(); |
216
|
|
|
|
217
|
|
|
/** |
218
|
|
|
* Returns the label to use for the current field. |
219
|
|
|
* Use null to fallback to the default label and false to hide the label. |
220
|
|
|
* |
221
|
|
|
* @return string|false|null |
222
|
|
|
*/ |
223
|
|
|
public function getLabel(); |
224
|
|
|
|
225
|
|
|
/** |
226
|
|
|
* Returns the translation domain to use for the current field. |
227
|
|
|
*/ |
228
|
|
|
public function getTranslationDomain(): string; |
229
|
|
|
|
230
|
|
|
/** |
231
|
|
|
* Returns true if field is sortable. |
232
|
|
|
*/ |
233
|
|
|
public function isSortable(): bool; |
234
|
|
|
|
235
|
|
|
/** |
236
|
|
|
* Returns the field mapping definition used when sorting. |
237
|
|
|
* |
238
|
|
|
* @return array the field mapping definition |
239
|
|
|
*/ |
240
|
|
|
public function getSortFieldMapping(): array; |
241
|
|
|
|
242
|
|
|
/** |
243
|
|
|
* Returns the parent association mapping definitions used when sorting. |
244
|
|
|
* |
245
|
|
|
* @return array the parent association mapping definitions |
246
|
|
|
*/ |
247
|
|
|
public function getSortParentAssociationMapping(): array; |
248
|
|
|
|
249
|
|
|
/** |
250
|
|
|
* @return mixed |
251
|
|
|
*/ |
252
|
|
|
public function getFieldValue(?object $object, ?string $fieldName); |
253
|
|
|
} |
254
|
|
|
|
This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.