forked from sonata-project/SonataAdminBundle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFieldDescriptionInterface.php
318 lines (277 loc) · 7.03 KB
/
FieldDescriptionInterface.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
<?php
/*
* This file is part of the Sonata package.
*
* (c) Thomas Rabaix <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sonata\AdminBundle\Admin;
use Sonata\AdminBundle\Admin\AdminInterface;
interface FieldDescriptionInterface
{
/**
* set the field name
*
* @param string $fieldName
*
* @return void
*/
public function setFieldName($fieldName);
/**
* return the field name
*
* @return string the field name
*/
public function getFieldName();
/**
* Set the name
*
* @param string $name
*
* @return void
*/
public function setName($name);
/**
* Return the name, the name can be used as a form label or table header
*
* @return string the name
*/
public function getName();
/**
* Return the value represented by the provided name
*
* @param string $name
* @param null $default
*
* @return array|null the value represented by the provided name
*/
public function getOption($name, $default = null);
/**
* Define an option, an option is has a name and a value
*
* @param string $name
* @param mixed $value
*
* @return void set the option value
*/
public function setOption($name, $value);
/**
* Define the options value, if the options array contains the reserved keywords
* - type
* - template
*
* Then the value are copied across to the related property value
*
* @param array $options
*
* @return void
*/
public function setOptions(array $options);
/**
* return options
*
* @return array options
*/
public function getOptions();
/**
* return the template used to render the field
*
* @param string $template
*
* @return void
*/
public function setTemplate($template);
/**
* return the template name
*
* @return string the template name
*/
public function getTemplate();
/**
* return the field type, the type is a mandatory field as it used to select the correct template
* or the logic associated to the current FieldDescription object
*
* @param string $type
*
* @return void the field type
*/
public function setType($type);
/**
* return the type
*
* @return int|string
*/
public function getType();
/**
* set the parent Admin (only used in nested admin)
*
* @param \Sonata\AdminBundle\Admin\AdminInterface $parent
*
* @return void
*/
public function setParent(AdminInterface $parent);
/**
* return the parent Admin (only used in nested admin)
*
* @return \Sonata\AdminBundle\Admin\AdminInterface
*/
public function getParent();
/**
* Define the association mapping definition
*
* @param array $associationMapping
*
* @return void
*/
public function setAssociationMapping($associationMapping);
/**
* return the association mapping definition
*
* @return array
*/
public function getAssociationMapping();
/**
* return the related Target Entity
*
* @return string|null
*/
public function getTargetEntity();
/**
* set the field mapping information
*
* @param array $fieldMapping
*
* @return void
*/
public function setFieldMapping($fieldMapping);
/**
* return the field mapping definition
*
* @return array the field mapping definition
*/
public function getFieldMapping();
/**
* set the parent association mappings information
*
* @param array $parentAssociationMappings
*
* @return void
*/
public function setParentAssociationMappings(array $parentAssociationMappings);
/**
* return the parent association mapping definitions
*
* @return array the parent association mapping definitions
*/
public function getParentAssociationMappings();
/**
* set the association admin instance (only used if the field is linked to an Admin)
*
* @param \Sonata\AdminBundle\Admin\AdminInterface $associationAdmin the associated admin
*/
public function setAssociationAdmin(AdminInterface $associationAdmin);
/**
* return the associated Admin instance (only used if the field is linked to an Admin)
* @return \Sonata\AdminBundle\Admin\AdminInterface
*/
public function getAssociationAdmin();
/**
* return true if the FieldDescription is linked to an identifier field
*
* @return bool
*/
public function isIdentifier();
/**
* return the value linked to the description
*
* @param mixed $object
*
* @return bool|mixed
*/
public function getValue($object);
/**
* set the admin class linked to this FieldDescription
*
* @param \Sonata\AdminBundle\Admin\AdminInterface $admin
*
* @return void
*/
public function setAdmin(AdminInterface $admin);
/**
* @return \Sonata\AdminBundle\Admin\AdminInterface the admin class linked to this FieldDescription
*/
public function getAdmin();
/**
* merge option values related to the provided option name
*
* @throws \RuntimeException
*
* @param string $name
* @param array $options
*
* @return void
*/
public function mergeOption($name, array $options = array());
/**
* merge options values
*
* @param array $options
*
* @return void
*/
public function mergeOptions(array $options = array());
/**
* set the original mapping type (only used if the field is linked to an entity)
*
* @param string|int $mappingType
*
* @return void
*/
public function setMappingType($mappingType);
/**
* return the mapping type
*
* @return int|string
*/
public function getMappingType();
/**
* return the label to use for the current field
*
* @return string
*/
public function getLabel();
/**
* Return the translation domain to use for the current field.
*
* @return string
*/
public function getTranslationDomain();
/**
* Return true if field is sortable.
*
* @return boolean
*/
public function isSortable();
/**
* return the field mapping definition used when sorting
*
* @return array the field mapping definition
*/
public function getSortFieldMapping();
/**
* return the parent association mapping definitions used when sorting
*
* @return array the parent association mapping definitions
*/
public function getSortParentAssociationMapping();
/**
*
* @param object $object
* @param string $fieldName
*
* @return mixed
*/
public function getFieldValue($object, $fieldName);
}