Complex classes like AbstractAdmin often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use AbstractAdmin, and based on these observations, apply Extract Interface, too.
| 1 | <?php |
||
| 59 | abstract class AbstractAdmin implements AdminInterface, DomainObjectInterface, AdminTreeInterface |
||
| 60 | { |
||
| 61 | public const CONTEXT_MENU = 'menu'; |
||
| 62 | public const CONTEXT_DASHBOARD = 'dashboard'; |
||
| 63 | |||
| 64 | public const CLASS_REGEX = |
||
| 65 | '@ |
||
| 66 | (?:([A-Za-z0-9]*)\\\)? # vendor name / app name |
||
| 67 | (Bundle\\\)? # optional bundle directory |
||
| 68 | ([A-Za-z0-9]+?)(?:Bundle)?\\\ # bundle name, with optional suffix |
||
| 69 | ( |
||
| 70 | Entity|Document|Model|PHPCR|CouchDocument|Phpcr| |
||
| 71 | Doctrine\\\Orm|Doctrine\\\Phpcr|Doctrine\\\MongoDB|Doctrine\\\CouchDB |
||
| 72 | )\\\(.*)@x'; |
||
| 73 | |||
| 74 | public const MOSAIC_ICON_CLASS = 'fa fa-th-large fa-fw'; |
||
| 75 | |||
| 76 | /** |
||
| 77 | * The list FieldDescription constructed from the configureListField method. |
||
| 78 | * |
||
| 79 | * @var FieldDescriptionInterface[] |
||
| 80 | */ |
||
| 81 | protected $listFieldDescriptions = []; |
||
| 82 | |||
| 83 | /** |
||
| 84 | * The show FieldDescription constructed from the configureShowFields method. |
||
| 85 | * |
||
| 86 | * @var FieldDescriptionInterface[] |
||
| 87 | */ |
||
| 88 | protected $showFieldDescriptions = []; |
||
| 89 | |||
| 90 | /** |
||
| 91 | * The list FieldDescription constructed from the configureFormField method. |
||
| 92 | * |
||
| 93 | * @var FieldDescriptionInterface[] |
||
| 94 | */ |
||
| 95 | protected $formFieldDescriptions = []; |
||
| 96 | |||
| 97 | /** |
||
| 98 | * The filter FieldDescription constructed from the configureFilterField method. |
||
| 99 | * |
||
| 100 | * @var FieldDescriptionInterface[] |
||
| 101 | */ |
||
| 102 | protected $filterFieldDescriptions = []; |
||
| 103 | |||
| 104 | /** |
||
| 105 | * NEXT_MAJOR: Remove this property. |
||
| 106 | * |
||
| 107 | * The number of result to display in the list. |
||
| 108 | * |
||
| 109 | * @deprecated since sonata-project/admin-bundle 3.67. |
||
| 110 | * |
||
| 111 | * @var int |
||
| 112 | */ |
||
| 113 | protected $maxPerPage = 32; |
||
| 114 | |||
| 115 | /** |
||
| 116 | * The maximum number of page numbers to display in the list. |
||
| 117 | * |
||
| 118 | * @var int |
||
| 119 | */ |
||
| 120 | protected $maxPageLinks = 25; |
||
| 121 | |||
| 122 | /** |
||
| 123 | * The base route name used to generate the routing information. |
||
| 124 | * |
||
| 125 | * @var string |
||
| 126 | */ |
||
| 127 | protected $baseRouteName; |
||
| 128 | |||
| 129 | /** |
||
| 130 | * The base route pattern used to generate the routing information. |
||
| 131 | * |
||
| 132 | * @var string |
||
| 133 | */ |
||
| 134 | protected $baseRoutePattern; |
||
| 135 | |||
| 136 | /** |
||
| 137 | * The base name controller used to generate the routing information. |
||
| 138 | * |
||
| 139 | * @var string |
||
| 140 | */ |
||
| 141 | protected $baseControllerName; |
||
| 142 | |||
| 143 | /** |
||
| 144 | * The label class name (used in the title/breadcrumb ...). |
||
| 145 | * |
||
| 146 | * @var string |
||
| 147 | */ |
||
| 148 | protected $classnameLabel; |
||
| 149 | |||
| 150 | /** |
||
| 151 | * The translation domain to be used to translate messages. |
||
| 152 | * |
||
| 153 | * @var string |
||
| 154 | */ |
||
| 155 | protected $translationDomain = 'messages'; |
||
| 156 | |||
| 157 | /** |
||
| 158 | * Options to set to the form (ie, validation_groups). |
||
| 159 | * |
||
| 160 | * @var array |
||
| 161 | */ |
||
| 162 | protected $formOptions = []; |
||
| 163 | |||
| 164 | /** |
||
| 165 | * NEXT_MAJOR: Remove this property. |
||
| 166 | * |
||
| 167 | * Default values to the datagrid. |
||
| 168 | * |
||
| 169 | * @deprecated since sonata-project/admin-bundle 3.67, use configureDefaultSortValues() instead. |
||
| 170 | * |
||
| 171 | * @var array |
||
| 172 | */ |
||
| 173 | protected $datagridValues = [ |
||
| 174 | '_page' => 1, |
||
| 175 | '_per_page' => 32, |
||
| 176 | ]; |
||
| 177 | |||
| 178 | /** |
||
| 179 | * NEXT_MAJOR: Remove this property. |
||
| 180 | * |
||
| 181 | * Predefined per page options. |
||
| 182 | * |
||
| 183 | * @deprecated since sonata-project/admin-bundle 3.67. |
||
| 184 | * |
||
| 185 | * @var array |
||
| 186 | */ |
||
| 187 | protected $perPageOptions = [16, 32, 64, 128, 256]; |
||
| 188 | |||
| 189 | /** |
||
| 190 | * Pager type. |
||
| 191 | * |
||
| 192 | * @var string |
||
| 193 | */ |
||
| 194 | protected $pagerType = Pager::TYPE_DEFAULT; |
||
| 195 | |||
| 196 | /** |
||
| 197 | * The code related to the admin. |
||
| 198 | * |
||
| 199 | * @var string |
||
| 200 | */ |
||
| 201 | protected $code; |
||
| 202 | |||
| 203 | /** |
||
| 204 | * The label. |
||
| 205 | * |
||
| 206 | * @var string |
||
| 207 | */ |
||
| 208 | protected $label; |
||
| 209 | |||
| 210 | /** |
||
| 211 | * Whether or not to persist the filters in the session. |
||
| 212 | * |
||
| 213 | * NEXT_MAJOR: remove this property |
||
| 214 | * |
||
| 215 | * @var bool |
||
| 216 | * |
||
| 217 | * @deprecated since sonata-project/admin-bundle 3.34, to be removed in 4.0. |
||
| 218 | */ |
||
| 219 | protected $persistFilters = false; |
||
| 220 | |||
| 221 | /** |
||
| 222 | * Array of routes related to this admin. |
||
| 223 | * |
||
| 224 | * @var RouteCollection |
||
| 225 | */ |
||
| 226 | protected $routes; |
||
| 227 | |||
| 228 | /** |
||
| 229 | * The subject only set in edit/update/create mode. |
||
| 230 | * |
||
| 231 | * @var object|null |
||
| 232 | */ |
||
| 233 | protected $subject; |
||
| 234 | |||
| 235 | /** |
||
| 236 | * Define a Collection of child admin, ie /admin/order/{id}/order-element/{childId}. |
||
| 237 | * |
||
| 238 | * @var array |
||
| 239 | */ |
||
| 240 | protected $children = []; |
||
| 241 | |||
| 242 | /** |
||
| 243 | * Reference the parent admin. |
||
| 244 | * |
||
| 245 | * @var AdminInterface|null |
||
| 246 | */ |
||
| 247 | protected $parent; |
||
| 248 | |||
| 249 | /** |
||
| 250 | * The base code route refer to the prefix used to generate the route name. |
||
| 251 | * |
||
| 252 | * NEXT_MAJOR: remove this attribute. |
||
| 253 | * |
||
| 254 | * @deprecated This attribute is deprecated since sonata-project/admin-bundle 3.24 and will be removed in 4.0 |
||
| 255 | * |
||
| 256 | * @var string |
||
| 257 | */ |
||
| 258 | protected $baseCodeRoute = ''; |
||
| 259 | |||
| 260 | /** |
||
| 261 | * NEXT_MAJOR: should be default array and private. |
||
| 262 | * |
||
| 263 | * @var string|array |
||
| 264 | */ |
||
| 265 | protected $parentAssociationMapping; |
||
| 266 | |||
| 267 | /** |
||
| 268 | * Reference the parent FieldDescription related to this admin |
||
| 269 | * only set for FieldDescription which is associated to an Sub Admin instance. |
||
| 270 | * |
||
| 271 | * @var FieldDescriptionInterface |
||
| 272 | */ |
||
| 273 | protected $parentFieldDescription; |
||
| 274 | |||
| 275 | /** |
||
| 276 | * If true then the current admin is part of the nested admin set (from the url). |
||
| 277 | * |
||
| 278 | * @var bool |
||
| 279 | */ |
||
| 280 | protected $currentChild = false; |
||
| 281 | |||
| 282 | /** |
||
| 283 | * The uniqid is used to avoid clashing with 2 admin related to the code |
||
| 284 | * ie: a Block linked to a Block. |
||
| 285 | * |
||
| 286 | * @var string |
||
| 287 | */ |
||
| 288 | protected $uniqid; |
||
| 289 | |||
| 290 | /** |
||
| 291 | * The Entity or Document manager. |
||
| 292 | * |
||
| 293 | * @var ModelManagerInterface |
||
| 294 | */ |
||
| 295 | protected $modelManager; |
||
| 296 | |||
| 297 | /** |
||
| 298 | * The current request object. |
||
| 299 | * |
||
| 300 | * @var Request|null |
||
| 301 | */ |
||
| 302 | protected $request; |
||
| 303 | |||
| 304 | /** |
||
| 305 | * The translator component. |
||
| 306 | * |
||
| 307 | * NEXT_MAJOR: remove this property |
||
| 308 | * |
||
| 309 | * @var \Symfony\Component\Translation\TranslatorInterface |
||
| 310 | * |
||
| 311 | * @deprecated since sonata-project/admin-bundle 3.9, to be removed with 4.0 |
||
| 312 | */ |
||
| 313 | protected $translator; |
||
| 314 | |||
| 315 | /** |
||
| 316 | * The related form contractor. |
||
| 317 | * |
||
| 318 | * @var FormContractorInterface |
||
| 319 | */ |
||
| 320 | protected $formContractor; |
||
| 321 | |||
| 322 | /** |
||
| 323 | * The related list builder. |
||
| 324 | * |
||
| 325 | * @var ListBuilderInterface |
||
| 326 | */ |
||
| 327 | protected $listBuilder; |
||
| 328 | |||
| 329 | /** |
||
| 330 | * The related view builder. |
||
| 331 | * |
||
| 332 | * @var ShowBuilderInterface |
||
| 333 | */ |
||
| 334 | protected $showBuilder; |
||
| 335 | |||
| 336 | /** |
||
| 337 | * The related datagrid builder. |
||
| 338 | * |
||
| 339 | * @var DatagridBuilderInterface |
||
| 340 | */ |
||
| 341 | protected $datagridBuilder; |
||
| 342 | |||
| 343 | /** |
||
| 344 | * @var RouteBuilderInterface |
||
| 345 | */ |
||
| 346 | protected $routeBuilder; |
||
| 347 | |||
| 348 | /** |
||
| 349 | * The datagrid instance. |
||
| 350 | * |
||
| 351 | * @var DatagridInterface|null |
||
| 352 | */ |
||
| 353 | protected $datagrid; |
||
| 354 | |||
| 355 | /** |
||
| 356 | * The router instance. |
||
| 357 | * |
||
| 358 | * @var RouteGeneratorInterface|null |
||
| 359 | */ |
||
| 360 | protected $routeGenerator; |
||
| 361 | |||
| 362 | /** |
||
| 363 | * The generated breadcrumbs. |
||
| 364 | * |
||
| 365 | * NEXT_MAJOR : remove this property |
||
| 366 | * |
||
| 367 | * @var array |
||
| 368 | */ |
||
| 369 | protected $breadcrumbs = []; |
||
| 370 | |||
| 371 | /** |
||
| 372 | * @var SecurityHandlerInterface |
||
| 373 | */ |
||
| 374 | protected $securityHandler; |
||
| 375 | |||
| 376 | /** |
||
| 377 | * @var ValidatorInterface |
||
| 378 | */ |
||
| 379 | protected $validator; |
||
| 380 | |||
| 381 | /** |
||
| 382 | * The configuration pool. |
||
| 383 | * |
||
| 384 | * @var Pool |
||
| 385 | */ |
||
| 386 | protected $configurationPool; |
||
| 387 | |||
| 388 | /** |
||
| 389 | * @var ItemInterface |
||
| 390 | */ |
||
| 391 | protected $menu; |
||
| 392 | |||
| 393 | /** |
||
| 394 | * @var FactoryInterface |
||
| 395 | */ |
||
| 396 | protected $menuFactory; |
||
| 397 | |||
| 398 | /** |
||
| 399 | * @var array<string, bool> |
||
| 400 | */ |
||
| 401 | protected $loaded = [ |
||
| 402 | 'view_fields' => false, // NEXT_MAJOR: Remove this unused value. |
||
| 403 | 'view_groups' => false, // NEXT_MAJOR: Remove this unused value. |
||
| 404 | 'routes' => false, |
||
| 405 | 'tab_menu' => false, |
||
| 406 | 'show' => false, |
||
| 407 | 'list' => false, |
||
| 408 | 'form' => false, |
||
| 409 | 'datagrid' => false, |
||
| 410 | ]; |
||
| 411 | |||
| 412 | /** |
||
| 413 | * @var string[] |
||
| 414 | */ |
||
| 415 | protected $formTheme = []; |
||
| 416 | |||
| 417 | /** |
||
| 418 | * @var string[] |
||
| 419 | */ |
||
| 420 | protected $filterTheme = []; |
||
| 421 | |||
| 422 | /** |
||
| 423 | * @var array<string, string> |
||
| 424 | * |
||
| 425 | * @deprecated since sonata-project/admin-bundle 3.34, will be dropped in 4.0. Use TemplateRegistry services instead |
||
| 426 | */ |
||
| 427 | protected $templates = []; |
||
| 428 | |||
| 429 | /** |
||
| 430 | * @var AdminExtensionInterface[] |
||
| 431 | */ |
||
| 432 | protected $extensions = []; |
||
| 433 | |||
| 434 | /** |
||
| 435 | * @var LabelTranslatorStrategyInterface |
||
| 436 | */ |
||
| 437 | protected $labelTranslatorStrategy; |
||
| 438 | |||
| 439 | /** |
||
| 440 | * Setting to true will enable preview mode for |
||
| 441 | * the entity and show a preview button in the |
||
| 442 | * edit/create forms. |
||
| 443 | * |
||
| 444 | * @var bool |
||
| 445 | */ |
||
| 446 | protected $supportsPreviewMode = false; |
||
| 447 | |||
| 448 | /** |
||
| 449 | * Roles and permissions per role. |
||
| 450 | * |
||
| 451 | * @var array 'role' => ['permission', 'permission'] |
||
| 452 | */ |
||
| 453 | protected $securityInformation = []; |
||
| 454 | |||
| 455 | protected $cacheIsGranted = []; |
||
| 456 | |||
| 457 | /** |
||
| 458 | * Action list for the search result. |
||
| 459 | * |
||
| 460 | * @var string[] |
||
| 461 | */ |
||
| 462 | protected $searchResultActions = ['edit', 'show']; |
||
| 463 | |||
| 464 | protected $listModes = [ |
||
| 465 | 'list' => [ |
||
| 466 | 'class' => 'fa fa-list fa-fw', |
||
| 467 | ], |
||
| 468 | 'mosaic' => [ |
||
| 469 | 'class' => self::MOSAIC_ICON_CLASS, |
||
| 470 | ], |
||
| 471 | ]; |
||
| 472 | |||
| 473 | /** |
||
| 474 | * The Access mapping. |
||
| 475 | * |
||
| 476 | * @var array [action1 => requiredRole1, action2 => [requiredRole2, requiredRole3]] |
||
| 477 | */ |
||
| 478 | protected $accessMapping = []; |
||
| 479 | |||
| 480 | /** |
||
| 481 | * @var MutableTemplateRegistryInterface |
||
| 482 | */ |
||
| 483 | private $templateRegistry; |
||
| 484 | |||
| 485 | /** |
||
| 486 | * The class name managed by the admin class. |
||
| 487 | * |
||
| 488 | * @var string |
||
| 489 | */ |
||
| 490 | private $class; |
||
| 491 | |||
| 492 | /** |
||
| 493 | * The subclasses supported by the admin class. |
||
| 494 | * |
||
| 495 | * @var array<string, string> |
||
| 496 | */ |
||
| 497 | private $subClasses = []; |
||
| 498 | |||
| 499 | /** |
||
| 500 | * The list collection. |
||
| 501 | * |
||
| 502 | * @var FieldDescriptionCollection|null |
||
| 503 | */ |
||
| 504 | private $list; |
||
| 505 | |||
| 506 | /** |
||
| 507 | * @var FieldDescriptionCollection|null |
||
| 508 | */ |
||
| 509 | private $show; |
||
| 510 | |||
| 511 | /** |
||
| 512 | * @var Form|null |
||
| 513 | */ |
||
| 514 | private $form; |
||
| 515 | |||
| 516 | /** |
||
| 517 | * The cached base route name. |
||
| 518 | * |
||
| 519 | * @var string |
||
| 520 | */ |
||
| 521 | private $cachedBaseRouteName; |
||
| 522 | |||
| 523 | /** |
||
| 524 | * The cached base route pattern. |
||
| 525 | * |
||
| 526 | * @var string |
||
| 527 | */ |
||
| 528 | private $cachedBaseRoutePattern; |
||
| 529 | |||
| 530 | /** |
||
| 531 | * The form group disposition. |
||
| 532 | * |
||
| 533 | * NEXT_MAJOR: must have `[]` as default value and remove the possibility to |
||
| 534 | * hold boolean values. |
||
| 535 | * |
||
| 536 | * @var array|bool |
||
| 537 | */ |
||
| 538 | private $formGroups = false; |
||
| 539 | |||
| 540 | /** |
||
| 541 | * The form tabs disposition. |
||
| 542 | * |
||
| 543 | * NEXT_MAJOR: must have `[]` as default value and remove the possibility to |
||
| 544 | * hold boolean values. |
||
| 545 | * |
||
| 546 | * @var array|bool |
||
| 547 | */ |
||
| 548 | private $formTabs = false; |
||
| 549 | |||
| 550 | /** |
||
| 551 | * The view group disposition. |
||
| 552 | * |
||
| 553 | * NEXT_MAJOR: must have `[]` as default value and remove the possibility to |
||
| 554 | * hold boolean values. |
||
| 555 | * |
||
| 556 | * @var array|bool |
||
| 557 | */ |
||
| 558 | private $showGroups = false; |
||
| 559 | |||
| 560 | /** |
||
| 561 | * The view tab disposition. |
||
| 562 | * |
||
| 563 | * NEXT_MAJOR: must have `[]` as default value and remove the possibility to |
||
| 564 | * hold boolean values. |
||
| 565 | * |
||
| 566 | * @var array|bool |
||
| 567 | */ |
||
| 568 | private $showTabs = false; |
||
| 569 | |||
| 570 | /** |
||
| 571 | * The manager type to use for the admin. |
||
| 572 | * |
||
| 573 | * @var string |
||
| 574 | */ |
||
| 575 | private $managerType; |
||
| 576 | |||
| 577 | /** |
||
| 578 | * The breadcrumbsBuilder component. |
||
| 579 | * |
||
| 580 | * @var BreadcrumbsBuilderInterface |
||
| 581 | */ |
||
| 582 | private $breadcrumbsBuilder; |
||
| 583 | |||
| 584 | /** |
||
| 585 | * Component responsible for persisting filters. |
||
| 586 | * |
||
| 587 | * @var FilterPersisterInterface|null |
||
| 588 | */ |
||
| 589 | private $filterPersister; |
||
| 590 | |||
| 591 | /** |
||
| 592 | * @param string $code |
||
| 593 | * @param string $class |
||
| 594 | * @param string|null $baseControllerName |
||
| 595 | */ |
||
| 596 | public function __construct($code, $class, $baseControllerName = null) |
||
| 626 | |||
| 627 | /** |
||
| 628 | * {@inheritdoc} |
||
| 629 | */ |
||
| 630 | public function getExportFormats() |
||
| 636 | |||
| 637 | /** |
||
| 638 | * @return array |
||
| 639 | */ |
||
| 640 | public function getExportFields() |
||
| 652 | |||
| 653 | public function getDataSourceIterator() |
||
| 675 | |||
| 676 | public function validate(ErrorElement $errorElement, $object) |
||
| 679 | |||
| 680 | /** |
||
| 681 | * define custom variable. |
||
| 682 | */ |
||
| 683 | public function initialize() |
||
| 699 | |||
| 700 | public function configure() |
||
| 703 | |||
| 704 | public function update($object) |
||
| 724 | |||
| 725 | public function create($object) |
||
| 747 | |||
| 748 | public function delete($object) |
||
| 763 | |||
| 764 | /** |
||
| 765 | * @param object $object |
||
| 766 | */ |
||
| 767 | public function preValidate($object) |
||
| 770 | |||
| 771 | public function preUpdate($object) |
||
| 774 | |||
| 775 | public function postUpdate($object) |
||
| 778 | |||
| 779 | public function prePersist($object) |
||
| 782 | |||
| 783 | public function postPersist($object) |
||
| 786 | |||
| 787 | public function preRemove($object) |
||
| 790 | |||
| 791 | public function postRemove($object) |
||
| 794 | |||
| 795 | public function preBatchAction($actionName, ProxyQueryInterface $query, array &$idx, $allElements) |
||
| 798 | |||
| 799 | public function getFilterParameters() |
||
| 851 | |||
| 852 | /** |
||
| 853 | * NEXT_MAJOR: Change the visibility to protected (similar to buildShow, buildForm, ...). |
||
| 854 | */ |
||
| 855 | public function buildDatagrid() |
||
| 909 | |||
| 910 | /** |
||
| 911 | * Returns the name of the parent related field, so the field can be use to set the default |
||
| 912 | * value (ie the parent object) or to filter the object. |
||
| 913 | * |
||
| 914 | * @throws \InvalidArgumentException |
||
| 915 | * |
||
| 916 | * @return string|null |
||
| 917 | */ |
||
| 918 | public function getParentAssociationMapping() |
||
| 938 | |||
| 939 | /** |
||
| 940 | * @param string $code |
||
| 941 | * @param string $value |
||
| 942 | */ |
||
| 943 | final public function addParentAssociationMapping($code, $value) |
||
| 947 | |||
| 948 | /** |
||
| 949 | * Returns the baseRoutePattern used to generate the routing information. |
||
| 950 | * |
||
| 951 | * @throws \RuntimeException |
||
| 952 | * |
||
| 953 | * @return string the baseRoutePattern used to generate the routing information |
||
| 954 | */ |
||
| 955 | public function getBaseRoutePattern() |
||
| 997 | |||
| 998 | /** |
||
| 999 | * Returns the baseRouteName used to generate the routing information. |
||
| 1000 | * |
||
| 1001 | * @throws \RuntimeException |
||
| 1002 | * |
||
| 1003 | * @return string the baseRouteName used to generate the routing information |
||
| 1004 | */ |
||
| 1005 | public function getBaseRouteName() |
||
| 1046 | |||
| 1047 | /** |
||
| 1048 | * urlize the given word. |
||
| 1049 | * |
||
| 1050 | * @param string $word |
||
| 1051 | * @param string $sep the separator |
||
| 1052 | * |
||
| 1053 | * @return string |
||
| 1054 | */ |
||
| 1055 | public function urlize($word, $sep = '_') |
||
| 1059 | |||
| 1060 | public function getClass() |
||
| 1083 | |||
| 1084 | public function getSubClasses() |
||
| 1088 | |||
| 1089 | /** |
||
| 1090 | * NEXT_MAJOR: remove this method. |
||
| 1091 | */ |
||
| 1092 | public function addSubClass($subClass) |
||
| 1103 | |||
| 1104 | public function setSubClasses(array $subClasses) |
||
| 1108 | |||
| 1109 | public function hasSubClass($name) |
||
| 1113 | |||
| 1114 | public function hasActiveSubClass() |
||
| 1122 | |||
| 1123 | public function getActiveSubClass() |
||
| 1143 | |||
| 1144 | public function getActiveSubclassCode() |
||
| 1182 | |||
| 1183 | public function getBatchActions() |
||
| 1216 | |||
| 1217 | public function getRoutes() |
||
| 1223 | |||
| 1224 | public function getRouterIdParameter() |
||
| 1228 | |||
| 1229 | public function getIdParameter() |
||
| 1239 | |||
| 1240 | public function hasRoute($name) |
||
| 1248 | |||
| 1249 | /** |
||
| 1250 | * @param string $name |
||
| 1251 | * @param string|null $adminCode |
||
| 1252 | * |
||
| 1253 | * @return bool |
||
| 1254 | */ |
||
| 1255 | public function isCurrentRoute($name, $adminCode = null) |
||
| 1276 | |||
| 1277 | public function generateObjectUrl($name, $object, array $parameters = [], $referenceType = RoutingUrlGeneratorInterface::ABSOLUTE_PATH) |
||
| 1283 | |||
| 1284 | public function generateUrl($name, array $parameters = [], $referenceType = RoutingUrlGeneratorInterface::ABSOLUTE_PATH) |
||
| 1288 | |||
| 1289 | public function generateMenuUrl($name, array $parameters = [], $referenceType = RoutingUrlGeneratorInterface::ABSOLUTE_PATH) |
||
| 1293 | |||
| 1294 | final public function setTemplateRegistry(MutableTemplateRegistryInterface $templateRegistry) |
||
| 1298 | |||
| 1299 | /** |
||
| 1300 | * @param array<string, string> $templates |
||
| 1301 | */ |
||
| 1302 | public function setTemplates(array $templates) |
||
| 1309 | |||
| 1310 | /** |
||
| 1311 | * @param string $name |
||
| 1312 | * @param string $template |
||
| 1313 | */ |
||
| 1314 | public function setTemplate($name, $template) |
||
| 1321 | |||
| 1322 | /** |
||
| 1323 | * @deprecated since sonata-project/admin-bundle 3.34, will be dropped in 4.0. Use TemplateRegistry services instead |
||
| 1324 | * |
||
| 1325 | * @return array<string, string> |
||
| 1326 | */ |
||
| 1327 | public function getTemplates() |
||
| 1331 | |||
| 1332 | /** |
||
| 1333 | * @deprecated since sonata-project/admin-bundle 3.34, will be dropped in 4.0. Use TemplateRegistry services instead |
||
| 1334 | * |
||
| 1335 | * @param string $name |
||
| 1336 | * |
||
| 1337 | * @return string|null |
||
| 1338 | */ |
||
| 1339 | public function getTemplate($name) |
||
| 1343 | |||
| 1344 | public function getNewInstance() |
||
| 1353 | |||
| 1354 | public function getFormBuilder() |
||
| 1367 | |||
| 1368 | /** |
||
| 1369 | * This method is being called by the main admin class and the child class, |
||
| 1370 | * the getFormBuilder is only call by the main admin class. |
||
| 1371 | */ |
||
| 1372 | public function defineFormBuilder(FormBuilderInterface $formBuilder) |
||
| 1398 | |||
| 1399 | public function attachAdminClass(FieldDescriptionInterface $fieldDescription) |
||
| 1425 | |||
| 1426 | public function getObject($id) |
||
| 1435 | |||
| 1436 | public function getForm() |
||
| 1442 | |||
| 1443 | public function getList() |
||
| 1449 | |||
| 1450 | /** |
||
| 1451 | * @final since sonata-project/admin-bundle 3.63.0 |
||
| 1452 | */ |
||
| 1453 | public function createQuery($context = 'list') |
||
| 1471 | |||
| 1472 | public function getDatagrid() |
||
| 1478 | |||
| 1479 | public function buildTabMenu($action, ?AdminInterface $childAdmin = null) |
||
| 1506 | |||
| 1507 | public function buildSideMenu($action, ?AdminInterface $childAdmin = null) |
||
| 1511 | |||
| 1512 | /** |
||
| 1513 | * @param string $action |
||
| 1514 | * |
||
| 1515 | * @return ItemInterface |
||
| 1516 | */ |
||
| 1517 | public function getSideMenu($action, ?AdminInterface $childAdmin = null) |
||
| 1527 | |||
| 1528 | /** |
||
| 1529 | * Returns the root code. |
||
| 1530 | * |
||
| 1531 | * @return string the root code |
||
| 1532 | */ |
||
| 1533 | public function getRootCode() |
||
| 1537 | |||
| 1538 | /** |
||
| 1539 | * Returns the master admin. |
||
| 1540 | * |
||
| 1541 | * @return AbstractAdmin the root admin class |
||
| 1542 | */ |
||
| 1543 | public function getRoot() |
||
| 1551 | |||
| 1552 | public function setBaseControllerName($baseControllerName) |
||
| 1556 | |||
| 1557 | public function getBaseControllerName() |
||
| 1561 | |||
| 1562 | /** |
||
| 1563 | * @param string $label |
||
| 1564 | */ |
||
| 1565 | public function setLabel($label) |
||
| 1569 | |||
| 1570 | public function getLabel() |
||
| 1574 | |||
| 1575 | /** |
||
| 1576 | * @param bool $persist |
||
| 1577 | * |
||
| 1578 | * NEXT_MAJOR: remove this method |
||
| 1579 | * |
||
| 1580 | * @deprecated since sonata-project/admin-bundle 3.34, to be removed in 4.0. |
||
| 1581 | */ |
||
| 1582 | public function setPersistFilters($persist) |
||
| 1591 | |||
| 1592 | public function setFilterPersister(?FilterPersisterInterface $filterPersister = null) |
||
| 1598 | |||
| 1599 | /** |
||
| 1600 | * NEXT_MAJOR: Remove this method. |
||
| 1601 | * |
||
| 1602 | * @deprecated since sonata-project/admin-bundle 3.67, to be removed in 4.0. |
||
| 1603 | * |
||
| 1604 | * @param int $maxPerPage |
||
| 1605 | */ |
||
| 1606 | public function setMaxPerPage($maxPerPage) |
||
| 1615 | |||
| 1616 | /** |
||
| 1617 | * @return int |
||
| 1618 | */ |
||
| 1619 | public function getMaxPerPage() |
||
| 1627 | |||
| 1628 | /** |
||
| 1629 | * @param int $maxPageLinks |
||
| 1630 | */ |
||
| 1631 | public function setMaxPageLinks($maxPageLinks) |
||
| 1635 | |||
| 1636 | /** |
||
| 1637 | * @return int |
||
| 1638 | */ |
||
| 1639 | public function getMaxPageLinks() |
||
| 1643 | |||
| 1644 | public function getFormGroups() |
||
| 1655 | |||
| 1656 | public function setFormGroups(array $formGroups) |
||
| 1660 | |||
| 1661 | public function removeFieldFromFormGroup($key) |
||
| 1671 | |||
| 1672 | /** |
||
| 1673 | * @param string $group |
||
| 1674 | */ |
||
| 1675 | public function reorderFormGroup($group, array $keys) |
||
| 1682 | |||
| 1683 | public function getFormTabs() |
||
| 1694 | |||
| 1695 | public function setFormTabs(array $formTabs) |
||
| 1699 | |||
| 1700 | public function getShowTabs() |
||
| 1711 | |||
| 1712 | public function setShowTabs(array $showTabs) |
||
| 1716 | |||
| 1717 | public function getShowGroups() |
||
| 1728 | |||
| 1729 | public function setShowGroups(array $showGroups) |
||
| 1733 | |||
| 1734 | public function reorderShowGroup($group, array $keys) |
||
| 1741 | |||
| 1742 | public function setParentFieldDescription(FieldDescriptionInterface $parentFieldDescription) |
||
| 1746 | |||
| 1747 | public function getParentFieldDescription() |
||
| 1767 | |||
| 1768 | public function hasParentFieldDescription() |
||
| 1772 | |||
| 1773 | public function setSubject($subject) |
||
| 1790 | |||
| 1791 | public function getSubject() |
||
| 1811 | |||
| 1812 | public function hasSubject() |
||
| 1824 | |||
| 1825 | public function getFormFieldDescriptions() |
||
| 1831 | |||
| 1832 | public function getFormFieldDescription($name) |
||
| 1855 | |||
| 1856 | /** |
||
| 1857 | * Returns true if the admin has a FieldDescription with the given $name. |
||
| 1858 | * |
||
| 1859 | * @param string $name |
||
| 1860 | * |
||
| 1861 | * @return bool |
||
| 1862 | */ |
||
| 1863 | public function hasFormFieldDescription($name) |
||
| 1869 | |||
| 1870 | public function addFormFieldDescription($name, FieldDescriptionInterface $fieldDescription) |
||
| 1874 | |||
| 1875 | /** |
||
| 1876 | * remove a FieldDescription. |
||
| 1877 | * |
||
| 1878 | * @param string $name |
||
| 1879 | */ |
||
| 1880 | public function removeFormFieldDescription($name) |
||
| 1884 | |||
| 1885 | /** |
||
| 1886 | * build and return the collection of form FieldDescription. |
||
| 1887 | * |
||
| 1888 | * @return FieldDescriptionInterface[] collection of form FieldDescription |
||
| 1889 | */ |
||
| 1890 | public function getShowFieldDescriptions() |
||
| 1896 | |||
| 1897 | /** |
||
| 1898 | * Returns the form FieldDescription with the given $name. |
||
| 1899 | * |
||
| 1900 | * @param string $name |
||
| 1901 | * |
||
| 1902 | * @return FieldDescriptionInterface |
||
| 1903 | */ |
||
| 1904 | public function getShowFieldDescription($name) |
||
| 1927 | |||
| 1928 | public function hasShowFieldDescription($name) |
||
| 1934 | |||
| 1935 | public function addShowFieldDescription($name, FieldDescriptionInterface $fieldDescription) |
||
| 1939 | |||
| 1940 | public function removeShowFieldDescription($name) |
||
| 1944 | |||
| 1945 | public function getListFieldDescriptions() |
||
| 1951 | |||
| 1952 | public function getListFieldDescription($name) |
||
| 1976 | |||
| 1977 | public function hasListFieldDescription($name) |
||
| 1983 | |||
| 1984 | public function addListFieldDescription($name, FieldDescriptionInterface $fieldDescription) |
||
| 1988 | |||
| 1989 | public function removeListFieldDescription($name) |
||
| 1993 | |||
| 1994 | public function getFilterFieldDescription($name) |
||
| 2017 | |||
| 2018 | public function hasFilterFieldDescription($name) |
||
| 2024 | |||
| 2025 | public function addFilterFieldDescription($name, FieldDescriptionInterface $fieldDescription) |
||
| 2029 | |||
| 2030 | public function removeFilterFieldDescription($name) |
||
| 2034 | |||
| 2035 | public function getFilterFieldDescriptions() |
||
| 2041 | |||
| 2042 | public function addChild(AdminInterface $child) |
||
| 2075 | |||
| 2076 | public function hasChild($code) |
||
| 2080 | |||
| 2081 | public function getChildren() |
||
| 2085 | |||
| 2086 | public function getChild($code) |
||
| 2107 | |||
| 2108 | public function setParent(AdminInterface $parent) |
||
| 2112 | |||
| 2113 | public function getParent() |
||
| 2133 | |||
| 2134 | final public function getRootAncestor() |
||
| 2144 | |||
| 2145 | final public function getChildDepth() |
||
| 2157 | |||
| 2158 | final public function getCurrentLeafChildAdmin() |
||
| 2172 | |||
| 2173 | public function isChild() |
||
| 2177 | |||
| 2178 | /** |
||
| 2179 | * Returns true if the admin has children, false otherwise. |
||
| 2180 | * |
||
| 2181 | * @return bool if the admin has children |
||
| 2182 | */ |
||
| 2183 | public function hasChildren() |
||
| 2187 | |||
| 2188 | public function setUniqid($uniqid) |
||
| 2192 | |||
| 2193 | public function getUniqid() |
||
| 2201 | |||
| 2202 | /** |
||
| 2203 | * Returns the classname label. |
||
| 2204 | * |
||
| 2205 | * @return string the classname label |
||
| 2206 | */ |
||
| 2207 | public function getClassnameLabel() |
||
| 2211 | |||
| 2212 | public function getPersistentParameters() |
||
| 2228 | |||
| 2229 | /** |
||
| 2230 | * @param string $name |
||
| 2231 | * |
||
| 2232 | * @return mixed|null |
||
| 2233 | */ |
||
| 2234 | public function getPersistentParameter($name) |
||
| 2240 | |||
| 2241 | public function getBreadcrumbs($action) |
||
| 2251 | |||
| 2252 | /** |
||
| 2253 | * Generates the breadcrumbs array. |
||
| 2254 | * |
||
| 2255 | * Note: the method will be called by the top admin instance (parent => child) |
||
| 2256 | * |
||
| 2257 | * @param string $action |
||
| 2258 | * |
||
| 2259 | * @return array |
||
| 2260 | */ |
||
| 2261 | public function buildBreadcrumbs($action, ?ItemInterface $menu = null) |
||
| 2275 | |||
| 2276 | /** |
||
| 2277 | * NEXT_MAJOR : remove this method. |
||
| 2278 | * |
||
| 2279 | * @return BreadcrumbsBuilderInterface |
||
| 2280 | */ |
||
| 2281 | final public function getBreadcrumbsBuilder() |
||
| 2296 | |||
| 2297 | /** |
||
| 2298 | * NEXT_MAJOR : remove this method. |
||
| 2299 | * |
||
| 2300 | * @return AbstractAdmin |
||
| 2301 | */ |
||
| 2302 | final public function setBreadcrumbsBuilder(BreadcrumbsBuilderInterface $value) |
||
| 2313 | |||
| 2314 | public function setCurrentChild($currentChild) |
||
| 2318 | |||
| 2319 | /** |
||
| 2320 | * NEXT_MAJOR: Remove this method. |
||
| 2321 | * |
||
| 2322 | * @deprecated since sonata-project/admin-bundle 3.65, to be removed in 4.0 |
||
| 2323 | */ |
||
| 2324 | public function getCurrentChild() |
||
| 2337 | |||
| 2338 | public function isCurrentChild(): bool |
||
| 2342 | |||
| 2343 | /** |
||
| 2344 | * Returns the current child admin instance. |
||
| 2345 | * |
||
| 2346 | * @return AdminInterface|null the current child admin instance |
||
| 2347 | */ |
||
| 2348 | public function getCurrentChildAdmin() |
||
| 2358 | |||
| 2359 | public function trans($id, array $parameters = [], $domain = null, $locale = null) |
||
| 2370 | |||
| 2371 | /** |
||
| 2372 | * Translate a message id. |
||
| 2373 | * |
||
| 2374 | * NEXT_MAJOR: remove this method |
||
| 2375 | * |
||
| 2376 | * @param string $id |
||
| 2377 | * @param int $count |
||
| 2378 | * @param string|null $domain |
||
| 2379 | * @param string|null $locale |
||
| 2380 | * |
||
| 2381 | * @return string the translated string |
||
| 2382 | * |
||
| 2383 | * @deprecated since sonata-project/admin-bundle 3.9, to be removed with 4.0 |
||
| 2384 | */ |
||
| 2385 | public function transChoice($id, $count, array $parameters = [], $domain = null, $locale = null) |
||
| 2396 | |||
| 2397 | public function setTranslationDomain($translationDomain) |
||
| 2401 | |||
| 2402 | public function getTranslationDomain() |
||
| 2406 | |||
| 2407 | /** |
||
| 2408 | * {@inheritdoc} |
||
| 2409 | * |
||
| 2410 | * NEXT_MAJOR: remove this method |
||
| 2411 | * |
||
| 2412 | * @deprecated since sonata-project/admin-bundle 3.9, to be removed with 4.0 |
||
| 2413 | */ |
||
| 2414 | public function setTranslator(TranslatorInterface $translator) |
||
| 2426 | |||
| 2427 | /** |
||
| 2428 | * {@inheritdoc} |
||
| 2429 | * |
||
| 2430 | * NEXT_MAJOR: remove this method |
||
| 2431 | * |
||
| 2432 | * @deprecated since sonata-project/admin-bundle 3.9, to be removed with 4.0 |
||
| 2433 | */ |
||
| 2434 | public function getTranslator() |
||
| 2443 | |||
| 2444 | public function getTranslationLabel($label, $context = '', $type = '') |
||
| 2448 | |||
| 2449 | public function setRequest(Request $request) |
||
| 2457 | |||
| 2458 | public function getRequest() |
||
| 2467 | |||
| 2468 | public function hasRequest() |
||
| 2472 | |||
| 2473 | public function setFormContractor(FormContractorInterface $formBuilder) |
||
| 2477 | |||
| 2478 | /** |
||
| 2479 | * @return FormContractorInterface |
||
| 2480 | */ |
||
| 2481 | public function getFormContractor() |
||
| 2485 | |||
| 2486 | public function setDatagridBuilder(DatagridBuilderInterface $datagridBuilder) |
||
| 2490 | |||
| 2491 | public function getDatagridBuilder() |
||
| 2495 | |||
| 2496 | public function setListBuilder(ListBuilderInterface $listBuilder) |
||
| 2500 | |||
| 2501 | public function getListBuilder() |
||
| 2505 | |||
| 2506 | public function setShowBuilder(ShowBuilderInterface $showBuilder) |
||
| 2510 | |||
| 2511 | /** |
||
| 2512 | * @return ShowBuilderInterface |
||
| 2513 | */ |
||
| 2514 | public function getShowBuilder() |
||
| 2518 | |||
| 2519 | public function setConfigurationPool(Pool $configurationPool) |
||
| 2523 | |||
| 2524 | /** |
||
| 2525 | * @return Pool |
||
| 2526 | */ |
||
| 2527 | public function getConfigurationPool() |
||
| 2531 | |||
| 2532 | public function setRouteGenerator(RouteGeneratorInterface $routeGenerator) |
||
| 2536 | |||
| 2537 | /** |
||
| 2538 | * @return RouteGeneratorInterface |
||
| 2539 | */ |
||
| 2540 | public function getRouteGenerator() |
||
| 2544 | |||
| 2545 | public function getCode() |
||
| 2549 | |||
| 2550 | /** |
||
| 2551 | * NEXT_MAJOR: Remove this function. |
||
| 2552 | * |
||
| 2553 | * @deprecated This method is deprecated since sonata-project/admin-bundle 3.24 and will be removed in 4.0 |
||
| 2554 | * |
||
| 2555 | * @param string $baseCodeRoute |
||
| 2556 | */ |
||
| 2557 | public function setBaseCodeRoute($baseCodeRoute) |
||
| 2566 | |||
| 2567 | public function getBaseCodeRoute() |
||
| 2589 | |||
| 2590 | public function getModelManager() |
||
| 2594 | |||
| 2595 | public function setModelManager(ModelManagerInterface $modelManager) |
||
| 2599 | |||
| 2600 | public function getManagerType() |
||
| 2604 | |||
| 2605 | /** |
||
| 2606 | * @param string $type |
||
| 2607 | */ |
||
| 2608 | public function setManagerType($type) |
||
| 2612 | |||
| 2613 | public function getObjectIdentifier() |
||
| 2617 | |||
| 2618 | /** |
||
| 2619 | * Set the roles and permissions per role. |
||
| 2620 | */ |
||
| 2621 | public function setSecurityInformation(array $information) |
||
| 2625 | |||
| 2626 | public function getSecurityInformation() |
||
| 2630 | |||
| 2631 | /** |
||
| 2632 | * Return the list of permissions the user should have in order to display the admin. |
||
| 2633 | * |
||
| 2634 | * @param string $context |
||
| 2635 | * |
||
| 2636 | * @return array |
||
| 2637 | */ |
||
| 2638 | public function getPermissionsShow($context) |
||
| 2647 | |||
| 2648 | public function showIn($context) |
||
| 2657 | |||
| 2658 | public function createObjectSecurity($object) |
||
| 2662 | |||
| 2663 | public function setSecurityHandler(SecurityHandlerInterface $securityHandler) |
||
| 2667 | |||
| 2668 | public function getSecurityHandler() |
||
| 2672 | |||
| 2673 | public function isGranted($name, $object = null) |
||
| 2684 | |||
| 2685 | public function getUrlSafeIdentifier($model) |
||
| 2689 | |||
| 2690 | public function getNormalizedIdentifier($model) |
||
| 2694 | |||
| 2695 | public function id($model) |
||
| 2699 | |||
| 2700 | public function setValidator($validator) |
||
| 2711 | |||
| 2712 | public function getValidator() |
||
| 2716 | |||
| 2717 | public function getShow() |
||
| 2723 | |||
| 2724 | public function setFormTheme(array $formTheme) |
||
| 2728 | |||
| 2729 | public function getFormTheme() |
||
| 2733 | |||
| 2734 | public function setFilterTheme(array $filterTheme) |
||
| 2738 | |||
| 2739 | public function getFilterTheme() |
||
| 2743 | |||
| 2744 | public function addExtension(AdminExtensionInterface $extension) |
||
| 2748 | |||
| 2749 | public function getExtensions() |
||
| 2753 | |||
| 2754 | public function setMenuFactory(FactoryInterface $menuFactory) |
||
| 2758 | |||
| 2759 | public function getMenuFactory() |
||
| 2763 | |||
| 2764 | public function setRouteBuilder(RouteBuilderInterface $routeBuilder) |
||
| 2768 | |||
| 2769 | public function getRouteBuilder() |
||
| 2773 | |||
| 2774 | public function toString($object) |
||
| 2786 | |||
| 2787 | public function setLabelTranslatorStrategy(LabelTranslatorStrategyInterface $labelTranslatorStrategy) |
||
| 2791 | |||
| 2792 | public function getLabelTranslatorStrategy() |
||
| 2796 | |||
| 2797 | public function supportsPreviewMode() |
||
| 2801 | |||
| 2802 | /** |
||
| 2803 | * NEXT_MAJOR: Remove this. |
||
| 2804 | * |
||
| 2805 | * @deprecated since sonata-project/admin-bundle 3.67, to be removed in 4.0. |
||
| 2806 | * |
||
| 2807 | * Set custom per page options. |
||
| 2808 | */ |
||
| 2809 | public function setPerPageOptions(array $options) |
||
| 2818 | |||
| 2819 | /** |
||
| 2820 | * Returns predefined per page options. |
||
| 2821 | * |
||
| 2822 | * @return array |
||
| 2823 | */ |
||
| 2824 | public function getPerPageOptions() |
||
| 2836 | |||
| 2837 | /** |
||
| 2838 | * Set pager type. |
||
| 2839 | * |
||
| 2840 | * @param string $pagerType |
||
| 2841 | */ |
||
| 2842 | public function setPagerType($pagerType) |
||
| 2846 | |||
| 2847 | /** |
||
| 2848 | * Get pager type. |
||
| 2849 | * |
||
| 2850 | * @return string |
||
| 2851 | */ |
||
| 2852 | public function getPagerType() |
||
| 2856 | |||
| 2857 | /** |
||
| 2858 | * Returns true if the per page value is allowed, false otherwise. |
||
| 2859 | * |
||
| 2860 | * @param int $perPage |
||
| 2861 | * |
||
| 2862 | * @return bool |
||
| 2863 | */ |
||
| 2864 | public function determinedPerPageValue($perPage) |
||
| 2868 | |||
| 2869 | public function isAclEnabled() |
||
| 2873 | |||
| 2874 | public function getObjectMetadata($object) |
||
| 2878 | |||
| 2879 | public function getListModes() |
||
| 2883 | |||
| 2884 | public function setListMode($mode) |
||
| 2892 | |||
| 2893 | public function getListMode() |
||
| 2901 | |||
| 2902 | public function getAccessMapping() |
||
| 2906 | |||
| 2907 | public function checkAccess($action, $object = null) |
||
| 2929 | |||
| 2930 | /** |
||
| 2931 | * Hook to handle access authorization, without throw Exception. |
||
| 2932 | * |
||
| 2933 | * @param string $action |
||
| 2934 | * @param object $object |
||
| 2935 | * |
||
| 2936 | * @return bool |
||
| 2937 | */ |
||
| 2938 | public function hasAccess($action, $object = null) |
||
| 2958 | |||
| 2959 | /** |
||
| 2960 | * @param string $action |
||
| 2961 | * @param object|null $object |
||
| 2962 | * |
||
| 2963 | * @return array |
||
| 2964 | */ |
||
| 2965 | public function configureActionButtons($action, $object = null) |
||
| 3039 | |||
| 3040 | /** |
||
| 3041 | * @param string $action |
||
| 3042 | * @param object $object |
||
| 3043 | * |
||
| 3044 | * @return array |
||
| 3045 | */ |
||
| 3046 | public function getActionButtons($action, $object = null) |
||
| 3059 | |||
| 3060 | /** |
||
| 3061 | * Get the list of actions that can be accessed directly from the dashboard. |
||
| 3062 | * |
||
| 3063 | * @return array |
||
| 3064 | */ |
||
| 3065 | public function getDashboardActions() |
||
| 3092 | |||
| 3093 | /** |
||
| 3094 | * Setting to true will enable mosaic button for the admin screen. |
||
| 3095 | * Setting to false will hide mosaic button for the admin screen. |
||
| 3096 | * |
||
| 3097 | * @param bool $isShown |
||
| 3098 | */ |
||
| 3099 | final public function showMosaicButton($isShown) |
||
| 3107 | |||
| 3108 | /** |
||
| 3109 | * @param object $object |
||
| 3110 | */ |
||
| 3111 | final public function getSearchResultLink($object) |
||
| 3121 | |||
| 3122 | /** |
||
| 3123 | * Checks if a filter type is set to a default value. |
||
| 3124 | * |
||
| 3125 | * @param string $name |
||
| 3126 | * |
||
| 3127 | * @return bool |
||
| 3128 | */ |
||
| 3129 | final public function isDefaultFilter($name) |
||
| 3140 | |||
| 3141 | /** |
||
| 3142 | * Check object existence and access, without throw Exception. |
||
| 3143 | * |
||
| 3144 | * @param string $action |
||
| 3145 | * @param object $object |
||
| 3146 | * |
||
| 3147 | * @return bool |
||
| 3148 | */ |
||
| 3149 | public function canAccessObject($action, $object) |
||
| 3153 | |||
| 3154 | protected function configureQuery(ProxyQueryInterface $query): ProxyQueryInterface |
||
| 3158 | |||
| 3159 | /** |
||
| 3160 | * @return MutableTemplateRegistryInterface |
||
| 3161 | */ |
||
| 3162 | final protected function getTemplateRegistry() |
||
| 3166 | |||
| 3167 | /** |
||
| 3168 | * Returns a list of default sort values. |
||
| 3169 | * |
||
| 3170 | * @return array{_page?: int, _per_page?: int, _sort_by?: string, _sort_order?: string} |
||
| 3171 | */ |
||
| 3172 | final protected function getDefaultSortValues(): array |
||
| 3187 | |||
| 3188 | /** |
||
| 3189 | * Returns a list of default filters. |
||
| 3190 | * |
||
| 3191 | * @return array |
||
| 3192 | */ |
||
| 3193 | final protected function getDefaultFilterValues() |
||
| 3208 | |||
| 3209 | protected function configureFormFields(FormMapper $form) |
||
| 3212 | |||
| 3213 | protected function configureListFields(ListMapper $list) |
||
| 3216 | |||
| 3217 | protected function configureDatagridFilters(DatagridMapper $filter) |
||
| 3220 | |||
| 3221 | protected function configureShowFields(ShowMapper $show) |
||
| 3224 | |||
| 3225 | protected function configureRoutes(RouteCollection $collection) |
||
| 3228 | |||
| 3229 | /** |
||
| 3230 | * Allows you to customize batch actions. |
||
| 3231 | * |
||
| 3232 | * @param array $actions List of actions |
||
| 3233 | * |
||
| 3234 | * @return array |
||
| 3235 | */ |
||
| 3236 | protected function configureBatchActions($actions) |
||
| 3240 | |||
| 3241 | /** |
||
| 3242 | * NEXT_MAJOR: remove this method. |
||
| 3243 | * |
||
| 3244 | * @deprecated Use configureTabMenu instead |
||
| 3245 | */ |
||
| 3246 | protected function configureSideMenu(ItemInterface $menu, $action, ?AdminInterface $childAdmin = null) |
||
| 3249 | |||
| 3250 | /** |
||
| 3251 | * Configures the tab menu in your admin. |
||
| 3252 | * |
||
| 3253 | * @param string $action |
||
| 3254 | */ |
||
| 3255 | protected function configureTabMenu(ItemInterface $menu, $action, ?AdminInterface $childAdmin = null) |
||
| 3261 | |||
| 3262 | /** |
||
| 3263 | * build the view FieldDescription array. |
||
| 3264 | */ |
||
| 3265 | protected function buildShow() |
||
| 3282 | |||
| 3283 | /** |
||
| 3284 | * build the list FieldDescription array. |
||
| 3285 | */ |
||
| 3286 | protected function buildList() |
||
| 3343 | |||
| 3344 | /** |
||
| 3345 | * Build the form FieldDescription collection. |
||
| 3346 | */ |
||
| 3347 | protected function buildForm() |
||
| 3372 | |||
| 3373 | /** |
||
| 3374 | * Gets the subclass corresponding to the given name. |
||
| 3375 | * |
||
| 3376 | * @param string $name The name of the sub class |
||
| 3377 | * |
||
| 3378 | * @return string the subclass |
||
| 3379 | */ |
||
| 3380 | protected function getSubClass($name) |
||
| 3393 | |||
| 3394 | /** |
||
| 3395 | * Attach the inline validator to the model metadata, this must be done once per admin. |
||
| 3396 | */ |
||
| 3397 | protected function attachInlineValidator() |
||
| 3424 | |||
| 3425 | /** |
||
| 3426 | * NEXT_MAJOR: Remove this function. |
||
| 3427 | * |
||
| 3428 | * @deprecated since sonata-project/admin-bundle 3.67, to be removed in 4.0. |
||
| 3429 | * |
||
| 3430 | * Predefine per page options. |
||
| 3431 | */ |
||
| 3432 | protected function predefinePerPageOptions() |
||
| 3438 | |||
| 3439 | /** |
||
| 3440 | * Return list routes with permissions name. |
||
| 3441 | * |
||
| 3442 | * @return array<string, string> |
||
| 3443 | */ |
||
| 3444 | protected function getAccess() |
||
| 3469 | |||
| 3470 | /** |
||
| 3471 | * Configures a list of default filters. |
||
| 3472 | */ |
||
| 3473 | protected function configureDefaultFilterValues(array &$filterValues) |
||
| 3476 | |||
| 3477 | /** |
||
| 3478 | * Configures a list of default sort values. |
||
| 3479 | * |
||
| 3480 | * Example: |
||
| 3481 | * $sortValues['_sort_by'] = 'foo' |
||
| 3482 | * $sortValues['_sort_order'] = 'DESC' |
||
| 3483 | */ |
||
| 3484 | protected function configureDefaultSortValues(array &$sortValues) |
||
| 3487 | |||
| 3488 | /** |
||
| 3489 | * Build all the related urls to the current admin. |
||
| 3490 | */ |
||
| 3491 | private function buildRoutes(): void |
||
| 3514 | } |
||
| 3515 | |||
| 3517 |
If you suppress an error, we recommend checking for the error condition explicitly: