AdminInterface
last analyzed

Size/Duplication

Total Lines 516
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 516
c 0
b 0
f 0

122 Methods

Rating   Name   Duplication   Size   Complexity  
getMenuFactory() 0 1 ?
getListBuilder() 0 1 ?
setDatagridBuilder() 0 1 ?
getDatagridBuilder() 0 1 ?
setTranslator() 0 1 ?
setTemplate() 0 1 ?
setMenuFactory() 0 1 ?
getModelManager() 0 1 ?
getManagerType() 0 1 ?
createQuery() 0 1 ?
getFormBuilder() 0 1 ?
getForm() 0 1 ?
setFormContractor() 0 1 ?
setListBuilder() 0 1 ?
setBaseControllerName() 0 1 ?
getBaseControllerName() 0 1 ?
setTemplates() 0 1 ?
configureActionButtons() 0 1 ?
canAccessObject() 0 1 ?
getRoot() 0 1 ?
getRootCode() 0 1 ?
setFilterPersister() 0 1 ?
getBaseRoutePattern() 0 1 ?
getBaseRouteName() 0 1 ?
getSideMenu() 0 1 ?
addParentAssociationMapping() 0 1 ?
getRouteGenerator() 0 1 ?
getCurrentChildAdmin() 0 1 ?
getParentAssociationMapping() 0 1 ?
reorderFormGroup() 0 1 ?
defineFormBuilder() 0 1 ?
setRequest() 0 1 ?
setConfigurationPool() 0 1 ?
getClass() 0 1 ?
attachAdminClass() 0 1 ?
getDatagrid() 0 1 ?
getPagerType() 0 1 ?
getRequest() 0 1 ?
hasRequest() 0 1 ?
getCode() 0 1 ?
getBaseCodeRoute() 0 1 ?
getSecurityInformation() 0 1 ?
setParentFieldDescription() 0 1 ?
getParentFieldDescription() 0 1 ?
hasParentFieldDescription() 0 1 ?
getIdParameter() 0 1 ?
hasRoute() 0 1 ?
setSecurityHandler() 0 1 ?
getSecurityHandler() 0 1 ?
isGranted() 0 1 ?
getNormalizedIdentifier() 0 1 ?
id() 0 1 ?
setValidator() 0 1 ?
getValidator() 0 1 ?
getShow() 0 1 ?
setFormTheme() 0 1 ?
getList() 0 1 ?
getFormTheme() 0 1 ?
setFilterTheme() 0 1 ?
getFilterTheme() 0 1 ?
addExtension() 0 1 ?
getExtensions() 0 1 ?
setRouteBuilder() 0 1 ?
getRouteBuilder() 0 1 ?
toString() 0 1 ?
setLabelTranslatorStrategy() 0 1 ?
getLabelTranslatorStrategy() 0 1 ?
supportsPreviewMode() 0 1 ?
getNewInstance() 0 1 ?
setUniqid() 0 1 ?
getUniqid() 0 1 ?
getClassnameLabel() 0 1 ?
getObject() 0 1 ?
setSubject() 0 1 ?
getSubject() 0 1 ?
getExportFormats() 0 1 ?
getExportFields() 0 1 ?
getDataSourceIterator() 0 1 ?
preBatchAction() 0 1 ?
getFilterParameters() 0 1 ?
hasSubject() 0 1 ?
validate() 0 1 ?
showIn() 0 1 ?
createObjectSecurity() 0 1 ?
getParent() 0 1 ?
setParent() 0 1 ?
isChild() 0 1 ?
setTranslationDomain() 0 1 ?
getTranslationDomain() 0 1 ?
getFormGroups() 0 1 ?
setFormGroups() 0 1 ?
getFormTabs() 0 1 ?
setFormTabs() 0 1 ?
getShowTabs() 0 1 ?
setShowTabs() 0 1 ?
removeFieldFromFormGroup() 0 1 ?
getShowGroups() 0 1 ?
setShowGroups() 0 1 ?
reorderShowGroup() 0 1 ?
isAclEnabled() 0 1 ?
getSubClasses() 0 1 ?
setSubClasses() 0 1 ?
hasSubClass() 0 1 ?
hasActiveSubClass() 0 1 ?
getActiveSubClass() 0 1 ?
getActiveSubclassCode() 0 1 ?
getBatchActions() 0 1 ?
getLabel() 0 1 ?
getPersistentParameters() 0 1 ?
getPersistentParameter() 0 1 ?
setCurrentChild() 0 1 ?
isCurrentChild() 0 1 ?
getTranslationLabel() 0 1 ?
getObjectMetadata() 0 1 ?
getListModes() 0 1 ?
setListMode() 0 1 ?
getListMode() 0 1 ?
getActionButtons() 0 1 ?
getDashboardActions() 0 1 ?
isCurrentRoute() 0 1 ?
getSearchResultLink() 0 1 ?
showMosaicButton() 0 1 ?
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
use Knp\Menu\FactoryInterface;
17
use Knp\Menu\ItemInterface;
18
use Sonata\AdminBundle\Builder\DatagridBuilderInterface;
19
use Sonata\AdminBundle\Builder\FormContractorInterface;
20
use Sonata\AdminBundle\Builder\ListBuilderInterface;
21
use Sonata\AdminBundle\Builder\RouteBuilderInterface;
22
use Sonata\AdminBundle\Datagrid\DatagridInterface;
23
use Sonata\AdminBundle\Datagrid\ProxyQueryInterface;
24
use Sonata\AdminBundle\Filter\Persister\FilterPersisterInterface;
25
use Sonata\AdminBundle\Model\ModelManagerInterface;
26
use Sonata\AdminBundle\Object\MetadataInterface;
27
use Sonata\AdminBundle\Route\RouteGeneratorInterface;
28
use Sonata\AdminBundle\Security\Handler\SecurityHandlerInterface;
29
use Sonata\AdminBundle\Translator\LabelTranslatorStrategyInterface;
30
use Sonata\Exporter\Source\SourceIteratorInterface;
31
use Sonata\Form\Validator\ErrorElement;
32
use Symfony\Component\Form\FormBuilderInterface;
33
use Symfony\Component\Form\FormInterface;
34
use Symfony\Component\HttpFoundation\Request;
35
use Symfony\Component\Validator\Validator\ValidatorInterface;
36
use Symfony\Contracts\Translation\TranslatorInterface;
37
38
/**
39
 * @author Thomas Rabaix <[email protected]>
40
 */
41
interface AdminInterface extends AccessRegistryInterface, FieldDescriptionRegistryInterface, LifecycleHookProviderInterface, MenuBuilderInterface, ParentAdminInterface, UrlGeneratorInterface
42
{
43
    public function setMenuFactory(FactoryInterface $menuFactory): void;
44
45
    public function getMenuFactory(): ?FactoryInterface;
46
47
    public function setFormContractor(FormContractorInterface $formContractor): void;
48
49
    public function setListBuilder(ListBuilderInterface $listBuilder): void;
50
51
    public function getListBuilder(): ?ListBuilderInterface;
52
53
    public function setDatagridBuilder(DatagridBuilderInterface $datagridBuilder): void;
54
55
    public function getDatagridBuilder(): ?DatagridBuilderInterface;
56
57
    public function setTranslator(TranslatorInterface $translator): void;
58
59
    public function setRequest(Request $request): void;
60
61
    public function setConfigurationPool(Pool $pool): void;
62
63
    /**
64
     * Returns subjectClass/class/subclass name managed
65
     * - subclass name if subclass parameter is defined
66
     * - subject class name if subject is defined
67
     * - class name if not.
68
     */
69
    public function getClass(): string;
70
71
    public function attachAdminClass(FieldDescriptionInterface $fieldDescription): void;
72
73
    public function getDatagrid(): DatagridInterface;
74
75
    public function getPagerType(): string;
76
77
    /**
78
     * Set base controller name.
79
     */
80
    public function setBaseControllerName(string $baseControllerName): void;
81
82
    /**
83
     * Get base controller name.
84
     */
85
    public function getBaseControllerName(): string;
86
87
    /**
88
     * Sets a list of templates.
89
     */
90
    public function setTemplates(array $templates): void;
91
92
    /**
93
     * Sets a specific template.
94
     */
95
    public function setTemplate(string $name, string $template): void;
96
97
    public function getModelManager(): ?ModelManagerInterface;
98
99
    /**
100
     * @return string the manager type of the admin
101
     */
102
    public function getManagerType(): ?string;
103
104
    public function createQuery(): ProxyQueryInterface;
105
106
    /**
107
     * @return FormBuilderInterface the form builder
108
     */
109
    public function getFormBuilder(): FormBuilderInterface;
110
111
    /**
112
     * Returns a form depend on the given $object.
113
     */
114
    public function getForm(): ?FormInterface;
115
116
    public function getRequest(): Request;
117
118
    /**
119
     * @return bool true if a request object is linked to this Admin, false
120
     *              otherwise
121
     */
122
    public function hasRequest(): bool;
123
124
    public function getCode(): string;
125
126
    public function getBaseCodeRoute(): string;
127
128
    /**
129
     * Return the roles and permissions per role
130
     * - different permissions per role for the acl handler
131
     * - one permission that has the same name as the role for the role handler
132
     * This should be used by experimented users.
133
     *
134
     * @return array 'role' => ['permission', 'permission']
135
     */
136
    public function getSecurityInformation(): array;
137
138
    public function setParentFieldDescription(FieldDescriptionInterface $parentFieldDescription): void;
139
140
    /**
141
     * Get parent field description.
142
     *
143
     * @return FieldDescriptionInterface The parent field description
144
     */
145
    public function getParentFieldDescription(): ?FieldDescriptionInterface;
146
147
    /**
148
     * Returns true if the Admin is linked to a parent FieldDescription.
149
     */
150
    public function hasParentFieldDescription(): bool;
151
152
    /**
153
     * Returns the parameter representing request id, ie: id or childId.
154
     */
155
    public function getIdParameter(): string;
156
157
    /**
158
     * Returns true if the route $name is available.
159
     */
160
    public function hasRoute(string $name): bool;
161
162
    public function setSecurityHandler(SecurityHandlerInterface $securityHandler): void;
163
164
    public function getSecurityHandler(): ?SecurityHandlerInterface;
165
166
    /**
167
     * @param string|array $name
168
     */
169
    public function isGranted($name, ?object $object = null): bool;
170
171
    /**
172
     * @param mixed $model
173
     *
174
     * @return string a string representation of the identifiers for this instance
175
     */
176
    public function getNormalizedIdentifier($model): ?string;
177
178
    /**
179
     * Shorthand method for templating.
180
     *
181
     * @param object $model
182
     */
183
    public function id($model): ?string;
184
185
    public function setValidator(ValidatorInterface $validator): void;
186
187
    public function getValidator(): ?ValidatorInterface;
188
189
    public function getShow(): ?FieldDescriptionCollection;
190
191
    public function setFormTheme(array $formTheme): void;
192
193
    public function getList(): ?FieldDescriptionCollection;
194
195
    /**
196
     * @return string[]
197
     */
198
    public function getFormTheme(): array;
199
200
    public function setFilterTheme(array $filterTheme): void;
201
202
    /**
203
     * @return string[]
204
     */
205
    public function getFilterTheme(): array;
206
207
    public function addExtension(AdminExtensionInterface $extension): void;
208
209
    /**
210
     * Returns an array of extension related to the current Admin.
211
     *
212
     * @return AdminExtensionInterface[]
213
     */
214
    public function getExtensions(): array;
215
216
    public function setRouteBuilder(RouteBuilderInterface $routeBuilder): void;
217
218
    public function getRouteBuilder(): ?RouteBuilderInterface;
219
220
    /**
221
     * @param object $object
222
     */
223
    public function toString($object): string;
224
225
    public function setLabelTranslatorStrategy(LabelTranslatorStrategyInterface $labelTranslatorStrategy): void;
226
227
    public function getLabelTranslatorStrategy(): ?LabelTranslatorStrategyInterface;
228
229
    /**
230
     * Returning true will enable preview mode for
231
     * the target entity and show a preview button
232
     * when editing/creating an entity.
233
     */
234
    public function supportsPreviewMode(): bool;
235
236
    public function getNewInstance(): object;
237
238
    public function setUniqid(string $uniqId): void;
239
240
    /**
241
     * Returns the uniqid.
242
     */
243
    public function getUniqid(): string;
244
245
    /**
246
     * Returns the classname label.
247
     *
248
     * @return string the classname label
249
     */
250
    public function getClassnameLabel(): string;
251
252
    /**
253
     * @param mixed $id
254
     */
255
    public function getObject($id): ?object;
256
257
    public function setSubject(?object $subject): void;
258
259
    public function getSubject(): object;
260
261
    /**
262
     * Returns the array of allowed export formats.
263
     *
264
     * @return string[]
265
     */
266
    public function getExportFormats(): array;
267
268
    /**
269
     * Retuns a list of exported fields.
270
     */
271
    public function getExportFields(): array;
272
273
    /**
274
     * Returns SourceIterator.
275
     */
276
    public function getDataSourceIterator(): SourceIteratorInterface;
277
278
    /**
279
     * Call before the batch action, allow you to alter the query and the idx.
280
     */
281
    public function preBatchAction(string $actionName, ProxyQueryInterface $query, array &$idx, bool $allElements = false): void;
282
283
    /**
284
     * Return array of filter parameters.
285
     *
286
     * @return array<string, mixed>
0 ignored issues
show
Documentation introduced by
The doc-type array<string, could not be parsed: Expected ">" at position 5, but found "end of type". (view supported doc-types)

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.

Loading history...
287
     */
288
    public function getFilterParameters(): array;
289
290
    /**
291
     * Return true if the Admin is related to a subject.
292
     */
293
    public function hasSubject(): bool;
294
295
    /**
296
     * NEXT_MAJOR: remove this method.
297
     *
298
     * @param object $object
299
     *
300
     * @deprecated this feature cannot be stable, use a custom validator,
301
     *             the feature will be removed with Symfony 2.2
302
     */
303
    public function validate(ErrorElement $errorElement, $object): void;
304
305
    public function showIn(string $context): bool;
306
307
    /**
308
     * Add object security, fe. make the current user owner of the object.
309
     */
310
    public function createObjectSecurity(object $object): void;
311
312
    public function getParent(): self;
313
314
    public function setParent(self $admin): void;
315
316
    /**
317
     * Returns true if the Admin class has an Parent Admin defined.
318
     */
319
    public function isChild(): bool;
320
321
    /**
322
     * Set the translation domain.
323
     *
324
     * @param string $translationDomain the translation domain
325
     */
326
    public function setTranslationDomain(string $translationDomain): void;
327
328
    /**
329
     * Returns the translation domain.
330
     *
331
     * @return string the translation domain
332
     */
333
    public function getTranslationDomain(): string;
334
335
    /**
336
     * Return the form groups.
337
     *
338
     * @return array<string, mixed>
0 ignored issues
show
Documentation introduced by
The doc-type array<string, could not be parsed: Expected ">" at position 5, but found "end of type". (view supported doc-types)

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.

Loading history...
339
     */
340
    public function getFormGroups(): array;
341
342
    /**
343
     * Set the form groups.
344
     */
345
    public function setFormGroups(array $formGroups): void;
346
347
    /**
348
     * @return array<string, mixed>
0 ignored issues
show
Documentation introduced by
The doc-type array<string, could not be parsed: Expected ">" at position 5, but found "end of type". (view supported doc-types)

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.

Loading history...
349
     */
350
    public function getFormTabs(): array;
351
352
    public function setFormTabs(array $formTabs): void;
353
354
    /**
355
     * @return array<string, mixed>
0 ignored issues
show
Documentation introduced by
The doc-type array<string, could not be parsed: Expected ">" at position 5, but found "end of type". (view supported doc-types)

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.

Loading history...
356
     */
357
    public function getShowTabs(): array;
358
359
    public function setShowTabs(array $showTabs): void;
360
361
    /**
362
     * Remove a form group field.
363
     */
364
    public function removeFieldFromFormGroup(string $key): void;
365
366
    /**
367
     * Returns the show groups.
368
     *
369
     * @return array<string, mixed>
0 ignored issues
show
Documentation introduced by
The doc-type array<string, could not be parsed: Expected ">" at position 5, but found "end of type". (view supported doc-types)

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.

Loading history...
370
     */
371
    public function getShowGroups(): array;
372
373
    /**
374
     * Set the show groups.
375
     */
376
    public function setShowGroups(array $showGroups): void;
377
378
    /**
379
     * Reorder items in showGroup.
380
     */
381
    public function reorderShowGroup(string $group, array $keys): void;
382
383
    /**
384
     * Returns true if this admin uses ACL.
385
     */
386
    public function isAclEnabled(): bool;
387
388
    /**
389
     * Returns list of supported sub classes.
390
     */
391
    public function getSubClasses(): array;
392
393
    /**
394
     * Sets the list of supported sub classes.
395
     */
396
    public function setSubClasses(array $subClasses): void;
397
398
    /**
399
     * Returns true if the admin has the sub classes.
400
     *
401
     * @param string $name The name of the sub class
402
     */
403
    public function hasSubClass(string $name): bool;
404
405
    /**
406
     * Returns true if a subclass is currently active.
407
     */
408
    public function hasActiveSubClass(): bool;
409
410
    /**
411
     * Returns the currently active sub class.
412
     *
413
     * @return string the active sub class
414
     */
415
    public function getActiveSubClass(): string;
416
417
    /**
418
     * Returns the currently active sub class code.
419
     *
420
     * @return string the code for active sub class
421
     */
422
    public function getActiveSubclassCode(): string;
423
424
    /**
425
     * Returns the list of batchs actions.
426
     *
427
     * @return array<string, mixed> the list of batchs actions
0 ignored issues
show
Documentation introduced by
The doc-type array<string, could not be parsed: Expected ">" at position 5, but found "end of type". (view supported doc-types)

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.

Loading history...
428
     */
429
    public function getBatchActions(): array;
430
431
    /**
432
     * Returns Admin`s label.
433
     */
434
    public function getLabel(): ?string;
435
436
    /**
437
     * Returns an array of persistent parameters.
438
     *
439
     * @return array<string, mixed>
0 ignored issues
show
Documentation introduced by
The doc-type array<string, could not be parsed: Expected ">" at position 5, but found "end of type". (view supported doc-types)

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.

Loading history...
440
     */
441
    public function getPersistentParameters(): array;
442
443
    public function getPersistentParameter(string $name);
444
445
    /**
446
     * Set the current child status.
447
     */
448
    public function setCurrentChild(bool $currentChild): void;
449
450
    /**
451
     * Returns the current child status.
452
     */
453
    public function isCurrentChild(): bool;
454
455
    /**
456
     * Get translation label using the current TranslationStrategy.
457
     */
458
    public function getTranslationLabel(string $label, string $context = '', string $type = ''): string;
459
460
    /**
461
     * @param object $object
462
     */
463
    public function getObjectMetadata($object): MetadataInterface;
464
465
    /**
466
     * @return array<string, array<string, mixed>>
0 ignored issues
show
Documentation introduced by
The doc-type array<string, could not be parsed: Expected ">" at position 5, but found "end of type". (view supported doc-types)

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.

Loading history...
467
     */
468
    public function getListModes(): array;
469
470
    public function setListMode(string $mode): void;
471
472
    /**
473
     * return the list mode.
474
     */
475
    public function getListMode(): string;
476
477
    /**
478
     * Configure buttons for an action.
479
     */
480
    public function getActionButtons(string $action, ?object $object = null): array;
481
482
    /**
483
     * Get the list of actions that can be accessed directly from the dashboard.
484
     */
485
    public function getDashboardActions(): array;
486
487
    /**
488
     * Check the current request is given route or not.
489
     */
490
    public function isCurrentRoute(string $name, ?string $adminCode = null): bool;
491
492
    /**
493
     * Returns the result link for an object.
494
     */
495
    public function getSearchResultLink(object $object): ?string;
496
497
    /**
498
     * Setting to true will enable mosaic button for the admin screen.
499
     * Setting to false will hide mosaic button for the admin screen.
500
     */
501
    public function showMosaicButton(bool $isShown): void;
502
503
    public function configureActionButtons(array $buttonList, string $action, ?object $object = null): array;
504
505
    /**
506
     * Check object existence and access, without throwing Exception.
507
     */
508
    public function canAccessObject(string $action, ?object $object = null): bool;
509
510
    /**
511
     * Returns the master admin.
512
     */
513
    public function getRoot(): self;
514
515
    /**
516
     * Returns the root code.
517
     */
518
    public function getRootCode(): string;
519
520
    public function setFilterPersister(?FilterPersisterInterface $filterPersister = null): void;
521
522
    /**
523
     * Returns the baseRoutePattern used to generate the routing information.
524
     */
525
    public function getBaseRoutePattern(): string;
526
527
    /**
528
     * Returns the baseRouteName used to generate the routing information.
529
     */
530
    public function getBaseRouteName(): string;
531
532
    public function getSideMenu(string $action, ?self $childAdmin = null): ItemInterface;
533
534
    public function addParentAssociationMapping(string $code, string $value): void;
535
536
    public function getRouteGenerator(): ?RouteGeneratorInterface;
537
538
    /**
539
     * Returns the current child admin instance.
540
     */
541
    public function getCurrentChildAdmin(): ?self;
542
543
    /**
544
     * Returns the name of the parent related field, so the field can be use to set the default
545
     * value (ie the parent object) or to filter the object.
546
     */
547
    public function getParentAssociationMapping(): ?string;
548
549
    public function reorderFormGroup(string $group, array $keys): void;
550
551
    /**
552
     * This method is being called by the main admin class and the child class,
553
     * the getFormBuilder is only call by the main admin class.
554
     */
555
    public function defineFormBuilder(FormBuilderInterface $formBuilder): void;
556
}
557
558
class_exists(ErrorElement::class);
559