These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
0 ignored issues
–
show
|
|||
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 as MenuFactoryInterface; |
||
17 | use Sonata\AdminBundle\Builder\DatagridBuilderInterface; |
||
18 | use Sonata\AdminBundle\Builder\FormContractorInterface; |
||
19 | use Sonata\AdminBundle\Builder\ListBuilderInterface; |
||
20 | use Sonata\AdminBundle\Builder\RouteBuilderInterface; |
||
21 | use Sonata\AdminBundle\Datagrid\ProxyQueryInterface; |
||
22 | use Sonata\AdminBundle\Object\MetadataInterface; |
||
23 | use Sonata\AdminBundle\Security\Handler\SecurityHandlerInterface; |
||
24 | use Sonata\AdminBundle\Translator\LabelTranslatorStrategyInterface; |
||
25 | use Sonata\Form\Validator\ErrorElement; |
||
26 | use Symfony\Component\Form\FormBuilderInterface; |
||
27 | use Symfony\Component\Form\FormInterface; |
||
28 | use Symfony\Component\HttpFoundation\Request; |
||
29 | use Symfony\Component\Translation\TranslatorInterface; |
||
30 | use Symfony\Component\Validator\Validator\ValidatorInterface; |
||
31 | |||
32 | /** |
||
33 | * @author Thomas Rabaix <[email protected]> |
||
34 | */ |
||
35 | interface AdminInterface extends AccessRegistryInterface, FieldDescriptionRegistryInterface, LifecycleHookProviderInterface, MenuBuilderInterface, ParentAdminInterface, UrlGeneratorInterface |
||
36 | { |
||
37 | public function setMenuFactory(MenuFactoryInterface $menuFactory); |
||
38 | |||
39 | /** |
||
40 | * @return MenuFactoryInterface |
||
41 | */ |
||
42 | public function getMenuFactory(); |
||
43 | |||
44 | public function setFormContractor(FormContractorInterface $formContractor); |
||
45 | |||
46 | public function setListBuilder(ListBuilderInterface $listBuilder); |
||
47 | |||
48 | /** |
||
49 | * @return ListBuilderInterface |
||
50 | */ |
||
51 | public function getListBuilder(); |
||
52 | |||
53 | public function setDatagridBuilder(DatagridBuilderInterface $datagridBuilder); |
||
54 | |||
55 | /** |
||
56 | * @return DatagridBuilderInterface |
||
57 | */ |
||
58 | public function getDatagridBuilder(); |
||
59 | |||
60 | public function setTranslator(TranslatorInterface $translator); |
||
61 | |||
62 | /** |
||
63 | * @return TranslatorInterface |
||
64 | */ |
||
65 | public function getTranslator(); |
||
66 | |||
67 | public function setRequest(Request $request); |
||
68 | |||
69 | public function setConfigurationPool(Pool $pool); |
||
70 | |||
71 | /** |
||
72 | * Returns subjectClass/class/subclass name managed |
||
73 | * - subclass name if subclass parameter is defined |
||
74 | * - subject class name if subject is defined |
||
75 | * - class name if not. |
||
76 | * |
||
77 | * @return string |
||
78 | */ |
||
79 | public function getClass(); |
||
80 | |||
81 | public function attachAdminClass(FieldDescriptionInterface $fieldDescription); |
||
82 | |||
83 | /** |
||
84 | * @return \Sonata\AdminBundle\Datagrid\DatagridInterface |
||
85 | */ |
||
86 | public function getDatagrid(); |
||
87 | |||
88 | /** |
||
89 | * Set base controller name. |
||
90 | * |
||
91 | * @param string $baseControllerName |
||
92 | */ |
||
93 | public function setBaseControllerName($baseControllerName); |
||
94 | |||
95 | /** |
||
96 | * Get base controller name. |
||
97 | * |
||
98 | * @return string |
||
99 | */ |
||
100 | public function getBaseControllerName(); |
||
101 | |||
102 | /** |
||
103 | * Sets a list of templates. |
||
104 | * |
||
105 | * @param array $templates |
||
106 | */ |
||
107 | public function setTemplates(array $templates); |
||
108 | |||
109 | /** |
||
110 | * Sets a specific template. |
||
111 | * |
||
112 | * @param string $name |
||
113 | * @param string $template |
||
114 | */ |
||
115 | public function setTemplate($name, $template); |
||
116 | |||
117 | /** |
||
118 | * Get all templates. |
||
119 | * |
||
120 | * @return array |
||
121 | */ |
||
122 | public function getTemplates(); |
||
123 | |||
124 | /** |
||
125 | * @return \Sonata\AdminBundle\Model\ModelManagerInterface |
||
126 | */ |
||
127 | public function getModelManager(); |
||
128 | |||
129 | /** |
||
130 | * @return string the manager type of the admin |
||
131 | */ |
||
132 | public function getManagerType(); |
||
133 | |||
134 | /** |
||
135 | * @param string $context NEXT_MAJOR: remove this argument |
||
136 | * |
||
137 | * @return ProxyQueryInterface |
||
138 | */ |
||
139 | public function createQuery($context = 'list'); |
||
140 | |||
141 | /** |
||
142 | * @return FormBuilderInterface the form builder |
||
143 | */ |
||
144 | public function getFormBuilder(); |
||
145 | |||
146 | /** |
||
147 | * Returns a form depend on the given $object. |
||
148 | * |
||
149 | * @return FormInterface |
||
150 | */ |
||
151 | public function getForm(); |
||
152 | |||
153 | /** |
||
154 | * @throws \RuntimeException if no request is set |
||
155 | * |
||
156 | * @return Request |
||
157 | */ |
||
158 | public function getRequest(); |
||
159 | |||
160 | /** |
||
161 | * @return bool true if a request object is linked to this Admin, false |
||
162 | * otherwise |
||
163 | */ |
||
164 | public function hasRequest(); |
||
165 | |||
166 | /** |
||
167 | * @return string |
||
168 | */ |
||
169 | public function getCode(); |
||
170 | |||
171 | /** |
||
172 | * @return string |
||
173 | */ |
||
174 | public function getBaseCodeRoute(); |
||
175 | |||
176 | /** |
||
177 | * Return the roles and permissions per role |
||
178 | * - different permissions per role for the acl handler |
||
179 | * - one permission that has the same name as the role for the role handler |
||
180 | * This should be used by experimented users. |
||
181 | * |
||
182 | * @return array 'role' => ['permission', 'permission'] |
||
183 | */ |
||
184 | public function getSecurityInformation(); |
||
185 | |||
186 | public function setParentFieldDescription(FieldDescriptionInterface $parentFieldDescription); |
||
187 | |||
188 | /** |
||
189 | * Get parent field description. |
||
190 | * |
||
191 | * @return FieldDescriptionInterface The parent field description |
||
192 | */ |
||
193 | public function getParentFieldDescription(); |
||
194 | |||
195 | /** |
||
196 | * Returns true if the Admin is linked to a parent FieldDescription. |
||
197 | * |
||
198 | * @return bool |
||
199 | */ |
||
200 | public function hasParentFieldDescription(); |
||
201 | |||
202 | /** |
||
203 | * translate a message id. |
||
204 | * |
||
205 | * NEXT_MAJOR: remove this method |
||
206 | * |
||
207 | * @param string $id |
||
208 | * @param string|null $domain |
||
209 | * @param string|null $locale |
||
210 | * |
||
211 | * @return string the translated string |
||
212 | * |
||
213 | * @deprecated since 3.9, to be removed in 4.0 |
||
214 | */ |
||
215 | public function trans($id, array $parameters = [], $domain = null, $locale = null); |
||
216 | |||
217 | /** |
||
218 | * Returns the parameter representing request id, ie: id or childId. |
||
219 | * |
||
220 | * @return string |
||
221 | */ |
||
222 | public function getIdParameter(); |
||
223 | |||
224 | /** |
||
225 | * Returns true if the route $name is available. |
||
226 | * |
||
227 | * @param string $name |
||
228 | * |
||
229 | * @return bool |
||
230 | */ |
||
231 | public function hasRoute($name); |
||
232 | |||
233 | public function setSecurityHandler(SecurityHandlerInterface $securityHandler); |
||
234 | |||
235 | /** |
||
236 | * @return SecurityHandlerInterface|null |
||
237 | */ |
||
238 | public function getSecurityHandler(); |
||
239 | |||
240 | /** |
||
241 | * @param string $name |
||
242 | * @param object|null $object |
||
243 | * |
||
244 | * @return bool |
||
245 | */ |
||
246 | public function isGranted($name, $object = null); |
||
247 | |||
248 | /** |
||
249 | * @param mixed $entity |
||
250 | * |
||
251 | * @return string a string representation of the identifiers for this instance |
||
252 | */ |
||
253 | public function getNormalizedIdentifier($entity); |
||
254 | |||
255 | /** |
||
256 | * Shorthand method for templating. |
||
257 | * |
||
258 | * @param object $entity |
||
259 | * |
||
260 | * @return mixed |
||
261 | */ |
||
262 | public function id($entity); |
||
263 | |||
264 | /** |
||
265 | * @param ValidatorInterface $validator |
||
266 | */ |
||
267 | public function setValidator($validator); |
||
268 | |||
269 | /** |
||
270 | * @return ValidatorInterface |
||
271 | */ |
||
272 | public function getValidator(); |
||
273 | |||
274 | /** |
||
275 | * @return array |
||
276 | */ |
||
277 | public function getShow(); |
||
278 | |||
279 | public function setFormTheme(array $formTheme); |
||
280 | |||
281 | /** |
||
282 | * @return array |
||
283 | */ |
||
284 | public function getFormTheme(); |
||
285 | |||
286 | public function setFilterTheme(array $filterTheme); |
||
287 | |||
288 | /** |
||
289 | * @return array |
||
290 | */ |
||
291 | public function getFilterTheme(); |
||
292 | |||
293 | public function addExtension(AdminExtensionInterface $extension); |
||
294 | |||
295 | /** |
||
296 | * Returns an array of extension related to the current Admin. |
||
297 | * |
||
298 | * @return AdminExtensionInterface[] |
||
299 | */ |
||
300 | public function getExtensions(); |
||
301 | |||
302 | public function setRouteBuilder(RouteBuilderInterface $routeBuilder); |
||
303 | |||
304 | /** |
||
305 | * @return RouteBuilderInterface |
||
306 | */ |
||
307 | public function getRouteBuilder(); |
||
308 | |||
309 | /** |
||
310 | * @param mixed $object |
||
311 | * |
||
312 | * @return string |
||
313 | */ |
||
314 | public function toString($object); |
||
315 | |||
316 | public function setLabelTranslatorStrategy(LabelTranslatorStrategyInterface $labelTranslatorStrategy); |
||
317 | |||
318 | /** |
||
319 | * @return LabelTranslatorStrategyInterface |
||
320 | */ |
||
321 | public function getLabelTranslatorStrategy(); |
||
322 | |||
323 | /** |
||
324 | * Returning true will enable preview mode for |
||
325 | * the target entity and show a preview button |
||
326 | * when editing/creating an entity. |
||
327 | * |
||
328 | * @return bool |
||
329 | */ |
||
330 | public function supportsPreviewMode(); |
||
331 | |||
332 | /** |
||
333 | * @return mixed a new object instance |
||
334 | */ |
||
335 | public function getNewInstance(); |
||
336 | |||
337 | /** |
||
338 | * @param string $uniqId |
||
339 | */ |
||
340 | public function setUniqid($uniqId); |
||
341 | |||
342 | /** |
||
343 | * Returns the uniqid. |
||
344 | * |
||
345 | * @return string |
||
346 | */ |
||
347 | public function getUniqid(); |
||
348 | |||
349 | /** |
||
350 | * Returns the classname label. |
||
351 | * |
||
352 | * @return string the classname label |
||
353 | */ |
||
354 | public function getClassnameLabel(); |
||
355 | |||
356 | /** |
||
357 | * @param mixed $id |
||
358 | * |
||
359 | * @return mixed |
||
360 | */ |
||
361 | public function getObject($id); |
||
362 | |||
363 | /** |
||
364 | * @param object $subject |
||
365 | */ |
||
366 | public function setSubject($subject); |
||
367 | |||
368 | /** |
||
369 | * @return mixed |
||
370 | */ |
||
371 | public function getSubject(); |
||
372 | |||
373 | /** |
||
374 | * Returns a list FieldDescription. |
||
375 | * |
||
376 | * @param string $name |
||
377 | * |
||
378 | * @return FieldDescriptionInterface |
||
379 | */ |
||
380 | public function getListFieldDescription($name); |
||
381 | |||
382 | /** |
||
383 | * Returns true if the list FieldDescription exists. |
||
384 | * |
||
385 | * @param string $name |
||
386 | * |
||
387 | * @return bool |
||
388 | */ |
||
389 | public function hasListFieldDescription($name); |
||
390 | |||
391 | /** |
||
392 | * Returns the collection of list FieldDescriptions. |
||
393 | * |
||
394 | * @return array |
||
395 | */ |
||
396 | public function getListFieldDescriptions(); |
||
397 | |||
398 | /** |
||
399 | * Returns the array of allowed export formats. |
||
400 | * |
||
401 | * @return array |
||
402 | */ |
||
403 | public function getExportFormats(); |
||
404 | |||
405 | /** |
||
406 | * Retuns a list of exported fields. |
||
407 | * |
||
408 | * @return array |
||
409 | */ |
||
410 | public function getExportFields(); |
||
411 | |||
412 | /** |
||
413 | * Returns SourceIterator. |
||
414 | * |
||
415 | * @return \Exporter\Source\SourceIteratorInterface |
||
416 | */ |
||
417 | public function getDataSourceIterator(); |
||
418 | |||
419 | /** |
||
420 | * Call before the batch action, allow you to alter the query and the idx. |
||
421 | * |
||
422 | * @param string $actionName |
||
423 | * @param array $idx |
||
424 | * @param bool $allElements |
||
425 | */ |
||
426 | public function preBatchAction($actionName, ProxyQueryInterface $query, array &$idx, $allElements); |
||
427 | |||
428 | /** |
||
429 | * Return array of filter parameters. |
||
430 | * |
||
431 | * @return array |
||
432 | */ |
||
433 | public function getFilterParameters(); |
||
434 | |||
435 | /** |
||
436 | * Return true if the Admin is related to a subject. |
||
437 | * |
||
438 | * @return bool |
||
439 | */ |
||
440 | public function hasSubject(); |
||
441 | |||
442 | /** |
||
443 | * NEXT_MAJOR: remove this method. |
||
444 | * |
||
445 | * @param mixed $object |
||
446 | * |
||
447 | * @deprecated this feature cannot be stable, use a custom validator, |
||
448 | * the feature will be removed with Symfony 2.2 |
||
449 | */ |
||
450 | public function validate(ErrorElement $errorElement, $object); |
||
451 | |||
452 | /** |
||
453 | * @param string $context |
||
454 | * |
||
455 | * @return bool |
||
456 | */ |
||
457 | public function showIn($context); |
||
458 | |||
459 | /** |
||
460 | * Add object security, fe. make the current user owner of the object. |
||
461 | * |
||
462 | * @param mixed $object |
||
463 | */ |
||
464 | public function createObjectSecurity($object); |
||
465 | |||
466 | /** |
||
467 | * @return AdminInterface|null |
||
468 | */ |
||
469 | public function getParent(); |
||
470 | |||
471 | public function setParent(self $admin); |
||
472 | |||
473 | /** |
||
474 | * Returns true if the Admin class has an Parent Admin defined. |
||
475 | * |
||
476 | * @return bool |
||
477 | */ |
||
478 | public function isChild(); |
||
479 | |||
480 | /** |
||
481 | * Returns template. |
||
482 | * |
||
483 | * @deprecated since 3.35. To be removed in 4.0. Use TemplateRegistry services instead |
||
484 | * |
||
485 | * @param string $name |
||
486 | * |
||
487 | * @return string|null |
||
488 | */ |
||
489 | public function getTemplate($name); |
||
490 | |||
491 | /** |
||
492 | * Set the translation domain. |
||
493 | * |
||
494 | * @param string $translationDomain the translation domain |
||
495 | */ |
||
496 | public function setTranslationDomain($translationDomain); |
||
497 | |||
498 | /** |
||
499 | * Returns the translation domain. |
||
500 | * |
||
501 | * @return string the translation domain |
||
502 | */ |
||
503 | public function getTranslationDomain(); |
||
504 | |||
505 | /** |
||
506 | * Return the form groups. |
||
507 | * |
||
508 | * @return array |
||
509 | */ |
||
510 | public function getFormGroups(); |
||
511 | |||
512 | /** |
||
513 | * Set the form groups. |
||
514 | */ |
||
515 | public function setFormGroups(array $formGroups); |
||
516 | |||
517 | public function getFormTabs(); |
||
518 | |||
519 | public function setFormTabs(array $formTabs); |
||
520 | |||
521 | public function getShowTabs(); |
||
522 | |||
523 | public function setShowTabs(array $showTabs); |
||
524 | |||
525 | /** |
||
526 | * Remove a form group field. |
||
527 | * |
||
528 | * @param string $key |
||
529 | */ |
||
530 | public function removeFieldFromFormGroup($key); |
||
531 | |||
532 | /** |
||
533 | * Returns the show groups. |
||
534 | * |
||
535 | * @return array |
||
536 | */ |
||
537 | public function getShowGroups(); |
||
538 | |||
539 | /** |
||
540 | * Set the show groups. |
||
541 | */ |
||
542 | public function setShowGroups(array $showGroups); |
||
543 | |||
544 | /** |
||
545 | * Reorder items in showGroup. |
||
546 | * |
||
547 | * @param string $group |
||
548 | */ |
||
549 | public function reorderShowGroup($group, array $keys); |
||
550 | |||
551 | /** |
||
552 | * add a FieldDescription. |
||
553 | * |
||
554 | * @param string $name |
||
555 | */ |
||
556 | public function addFormFieldDescription($name, FieldDescriptionInterface $fieldDescription); |
||
557 | |||
558 | /** |
||
559 | * Remove a FieldDescription. |
||
560 | * |
||
561 | * @param string $name |
||
562 | */ |
||
563 | public function removeFormFieldDescription($name); |
||
564 | |||
565 | /** |
||
566 | * Returns true if this admin uses ACL. |
||
567 | * |
||
568 | * @return bool |
||
569 | */ |
||
570 | public function isAclEnabled(); |
||
571 | |||
572 | /** |
||
573 | * Returns list of supported sub classes. |
||
574 | * |
||
575 | * @return array |
||
576 | */ |
||
577 | public function getSubClasses(); |
||
578 | |||
579 | /** |
||
580 | * Adds a new class to a list of supported sub classes. |
||
581 | * |
||
582 | * @param $subClass |
||
583 | */ |
||
584 | public function addSubClass($subClass); |
||
585 | |||
586 | /** |
||
587 | * Sets the list of supported sub classes. |
||
588 | */ |
||
589 | public function setSubClasses(array $subClasses); |
||
590 | |||
591 | /** |
||
592 | * Returns true if the admin has the sub classes. |
||
593 | * |
||
594 | * @param string $name The name of the sub class |
||
595 | * |
||
596 | * @return bool |
||
597 | */ |
||
598 | public function hasSubClass($name); |
||
599 | |||
600 | /** |
||
601 | * Returns true if a subclass is currently active. |
||
602 | * |
||
603 | * @return bool |
||
604 | */ |
||
605 | public function hasActiveSubClass(); |
||
606 | |||
607 | /** |
||
608 | * Returns the currently active sub class. |
||
609 | * |
||
610 | * @return string the active sub class |
||
611 | */ |
||
612 | public function getActiveSubClass(); |
||
613 | |||
614 | /** |
||
615 | * Returns the currently active sub class code. |
||
616 | * |
||
617 | * @return string the code for active sub class |
||
618 | */ |
||
619 | public function getActiveSubclassCode(); |
||
620 | |||
621 | /** |
||
622 | * Returns the list of batchs actions. |
||
623 | * |
||
624 | * @return array the list of batchs actions |
||
625 | */ |
||
626 | public function getBatchActions(); |
||
627 | |||
628 | /** |
||
629 | * Returns Admin`s label. |
||
630 | * |
||
631 | * @return string |
||
632 | */ |
||
633 | public function getLabel(); |
||
634 | |||
635 | /** |
||
636 | * Returns an array of persistent parameters. |
||
637 | * |
||
638 | * @return array |
||
639 | */ |
||
640 | public function getPersistentParameters(); |
||
641 | |||
642 | /** |
||
643 | * @param string $name |
||
644 | * |
||
645 | * @return mixed|null |
||
646 | */ |
||
647 | public function getPersistentParameter($name); |
||
648 | |||
649 | /** |
||
650 | * Set the current child status. |
||
651 | * |
||
652 | * @param bool $currentChild |
||
653 | */ |
||
654 | public function setCurrentChild($currentChild); |
||
655 | |||
656 | /** |
||
657 | * Returns the current child status. |
||
658 | * |
||
659 | * @return bool |
||
660 | */ |
||
661 | public function getCurrentChild(); |
||
662 | |||
663 | /** |
||
664 | * Get translation label using the current TranslationStrategy. |
||
665 | * |
||
666 | * @param string $label |
||
667 | * @param string $context |
||
668 | * @param string $type |
||
669 | * |
||
670 | * @return string |
||
671 | */ |
||
672 | public function getTranslationLabel($label, $context = '', $type = ''); |
||
673 | |||
674 | /** |
||
675 | * @return MetadataInterface |
||
676 | */ |
||
677 | public function getObjectMetadata($object); |
||
678 | |||
679 | /** |
||
680 | * @return array |
||
681 | */ |
||
682 | public function getListModes(); |
||
683 | |||
684 | /** |
||
685 | * @param string $mode |
||
686 | */ |
||
687 | public function setListMode($mode); |
||
688 | |||
689 | /** |
||
690 | * return the list mode. |
||
691 | * |
||
692 | * @return string |
||
693 | */ |
||
694 | public function getListMode(); |
||
695 | |||
696 | /* |
||
697 | * Configure buttons for an action |
||
698 | * |
||
699 | * @param string $action |
||
700 | * @param mixed $object |
||
701 | * |
||
702 | * @return array |
||
703 | */ |
||
704 | public function getActionButtons($action, $object = null); |
||
705 | |||
706 | /** |
||
707 | * Get the list of actions that can be accessed directly from the dashboard. |
||
708 | * |
||
709 | * @return array |
||
710 | */ |
||
711 | public function getDashboardActions(); |
||
712 | |||
713 | /** |
||
714 | * Check the current request is given route or not. |
||
715 | * |
||
716 | * @param string $name |
||
717 | * @param string $adminCode |
||
718 | * |
||
719 | * @return bool |
||
720 | */ |
||
721 | public function isCurrentRoute($name, $adminCode = null); |
||
722 | |||
723 | /** |
||
724 | * Returns the result link for an object. |
||
725 | * |
||
726 | * @param mixed $object |
||
727 | * |
||
728 | * @return string|null |
||
729 | */ |
||
730 | public function getSearchResultLink($object); |
||
731 | |||
732 | /** |
||
733 | * Setting to true will enable mosaic button for the admin screen. |
||
734 | * Setting to false will hide mosaic button for the admin screen. |
||
735 | * |
||
736 | * @param bool $isShown |
||
737 | */ |
||
738 | public function showMosaicButton($isShown); |
||
739 | |||
740 | /** |
||
741 | * Checks if a filter type is set to a default value. |
||
742 | * |
||
743 | * @param string $name |
||
744 | * |
||
745 | * @return bool |
||
746 | */ |
||
747 | public function isDefaultFilter($name); |
||
748 | } |
||
749 | |||
750 | class_exists(\Sonata\Form\Validator\ErrorElement::class); |
||
751 |
The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.
The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.
To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.