Skip to content

Commit

Permalink
Merge branch '3.x'
Browse files Browse the repository at this point in the history
  • Loading branch information
VincentLanglet committed Dec 16, 2020
2 parents ce892c9 + 94b4fae commit 8d49890
Show file tree
Hide file tree
Showing 21 changed files with 1,389 additions and 683 deletions.
574 changes: 84 additions & 490 deletions src/Admin/AbstractAdmin.php

Large diffs are not rendered by default.

114 changes: 19 additions & 95 deletions src/Admin/AdminInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,58 +13,28 @@

namespace Sonata\AdminBundle\Admin;

use Knp\Menu\FactoryInterface;
use Knp\Menu\ItemInterface;
use Sonata\AdminBundle\Builder\DatagridBuilderInterface;
use Sonata\AdminBundle\Builder\FormContractorInterface;
use Sonata\AdminBundle\Builder\ListBuilderInterface;
use Sonata\AdminBundle\Builder\RouteBuilderInterface;
use Sonata\AdminBundle\Datagrid\DatagridInterface;
use Sonata\AdminBundle\Datagrid\ProxyQueryInterface;
use Sonata\AdminBundle\Exporter\DataSourceInterface;
use Sonata\AdminBundle\Filter\Persister\FilterPersisterInterface;
use Sonata\AdminBundle\Model\ModelManagerInterface;
use Sonata\AdminBundle\DependencyInjection\Admin\TaggedAdminInterface;
use Sonata\AdminBundle\Object\MetadataInterface;
use Sonata\AdminBundle\Route\RouteGeneratorInterface;
use Sonata\AdminBundle\Security\Handler\SecurityHandlerInterface;
use Sonata\AdminBundle\Templating\MutableTemplateRegistryAwareInterface;
use Sonata\AdminBundle\Translator\LabelTranslatorStrategyInterface;
use Sonata\Exporter\Source\SourceIteratorInterface;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Contracts\Translation\TranslatorInterface;

/**
* @author Thomas Rabaix <[email protected]>
*
* @phpstan-template T of object
* @phpstan-extends TaggedAdminInterface<T>
* @phpstan-extends AccessRegistryInterface<T>
* @phpstan-extends UrlGeneratorInterface<T>
* @phpstan-extends LifecycleHookProviderInterface<T>
*/
interface AdminInterface extends AccessRegistryInterface, FieldDescriptionRegistryInterface, LifecycleHookProviderInterface, MenuBuilderInterface, ParentAdminInterface, UrlGeneratorInterface, MutableTemplateRegistryAwareInterface
interface AdminInterface extends TaggedAdminInterface, AccessRegistryInterface, FieldDescriptionRegistryInterface, LifecycleHookProviderInterface, MenuBuilderInterface, ParentAdminInterface, UrlGeneratorInterface, MutableTemplateRegistryAwareInterface
{
public function setMenuFactory(FactoryInterface $menuFactory): void;

public function getMenuFactory(): ?FactoryInterface;

public function setFormContractor(FormContractorInterface $formContractor): void;

public function setListBuilder(ListBuilderInterface $listBuilder): void;

public function getListBuilder(): ?ListBuilderInterface;

public function setDatagridBuilder(DatagridBuilderInterface $datagridBuilder): void;

public function getDatagridBuilder(): ?DatagridBuilderInterface;

public function setTranslator(TranslatorInterface $translator): void;

public function setRequest(Request $request): void;

public function setConfigurationPool(Pool $pool): void;

/**
* Returns subjectClass/class/subclass name managed
* - subclass name if subclass parameter is defined
Expand All @@ -79,8 +49,6 @@ public function attachAdminClass(FieldDescriptionInterface $fieldDescription): v

public function getDatagrid(): DatagridInterface;

public function getPagerType(): string;

/**
* Set base controller name.
*/
Expand All @@ -98,29 +66,22 @@ public function getBaseControllerName(): string;
*/
public function setTemplates(array $templates): void;

public function getDataSource(): ?DataSourceInterface;

/**
* Sets a specific template.
*/
public function setTemplate(string $name, string $template): void;

public function getModelManager(): ?ModelManagerInterface;

public function getManagerType(): ?string;

public function createQuery(): ProxyQueryInterface;

/**
* @return FormBuilderInterface the form builder
*/
public function getFormBuilder(): FormBuilderInterface;

/**
* Returns a form depend on the given $object.
*/
public function getForm(): FormInterface;

public function setRequest(Request $request): void;

public function getRequest(): Request;

/**
Expand All @@ -132,16 +93,6 @@ public function getCode(): string;

public function getBaseCodeRoute(): string;

/**
* Return the roles and permissions per role
* - different permissions per role for the acl handler
* - one permission that has the same name as the role for the role handler
* This should be used by experimented users.
*
* @return array<string, string[]|string> 'role' => ['permission', 'permission']
*/
public function getSecurityInformation(): array;

public function setParentFieldDescription(FieldDescriptionInterface $parentFieldDescription): void;

/**
Expand All @@ -164,10 +115,6 @@ public function getIdParameter(): string;
*/
public function hasRoute(string $name): bool;

public function setSecurityHandler(SecurityHandlerInterface $securityHandler): void;

public function getSecurityHandler(): ?SecurityHandlerInterface;

/**
* @param string|string[] $name
*
Expand All @@ -191,13 +138,13 @@ public function id(object $model): ?string;

public function getShow(): FieldDescriptionCollection;

public function getList(): FieldDescriptionCollection;

/**
* @param string[] $formTheme
*/
public function setFormTheme(array $formTheme): void;

public function getList(): FieldDescriptionCollection;

/**
* @return string[]
*/
Expand All @@ -222,19 +169,11 @@ public function addExtension(AdminExtensionInterface $extension): void;
*/
public function getExtensions(): array;

public function setRouteBuilder(RouteBuilderInterface $routeBuilder): void;

public function getRouteBuilder(): ?RouteBuilderInterface;

/**
* @phpstan-param T $object
*/
public function toString(object $object): string;

public function setLabelTranslatorStrategy(LabelTranslatorStrategyInterface $labelTranslatorStrategy): void;

public function getLabelTranslatorStrategy(): ?LabelTranslatorStrategyInterface;

/**
* Returning true will enable preview mode for
* the target entity and show a preview button
Expand Down Expand Up @@ -267,6 +206,11 @@ public function setSubject(?object $subject): void;

public function getSubject(): object;

/**
* Return true if the Admin is related to a subject.
*/
public function hasSubject(): bool;

/**
* Returns the array of allowed export formats.
*
Expand Down Expand Up @@ -297,11 +241,6 @@ public function preBatchAction(string $actionName, ProxyQueryInterface $query, a
*/
public function getFilterParameters(): array;

/**
* Return true if the Admin is related to a subject.
*/
public function hasSubject(): bool;

public function showIn(string $context): bool;

/**
Expand Down Expand Up @@ -334,6 +273,11 @@ public function getFormGroups(): array;
*/
public function setFormGroups(array $formGroups): void;

/**
* @param string[] $keys
*/
public function reorderFormGroup(string $group, array $keys): void;

/**
* @return array<string, mixed>
*/
Expand Down Expand Up @@ -431,11 +375,6 @@ public function getActiveSubclassCode(): string;
*/
public function getBatchActions(): array;

/**
* Returns Admin`s label.
*/
public function getLabel(): ?string;

/**
* Returns an array of persistent parameters.
*
Expand Down Expand Up @@ -508,12 +447,6 @@ public function isCurrentRoute(string $name, ?string $adminCode = null): bool;
*/
public function getSearchResultLink(object $object): ?string;

/**
* Setting to true will enable mosaic button for the admin screen.
* Setting to false will hide mosaic button for the admin screen.
*/
public function showMosaicButton(bool $isShown): void;

/**
* @param array<string, array<string, mixed>> $buttonList
*
Expand All @@ -538,8 +471,6 @@ public function getRoot(): self;
*/
public function getRootCode(): string;

public function setFilterPersister(?FilterPersisterInterface $filterPersister = null): void;

/**
* Returns the baseRoutePattern used to generate the routing information.
*
Expand All @@ -558,23 +489,16 @@ public function getSideMenu(string $action, ?self $childAdmin = null): ItemInter

public function addParentAssociationMapping(string $code, string $value): void;

public function getRouteGenerator(): ?RouteGeneratorInterface;

/**
* Returns the current child admin instance.
*/
public function getCurrentChildAdmin(): ?self;

/**
* Returns the name of the parent related field, so the field can be use to set the default
* value (ie the parent object) or to filter the object.
*/
public function getParentAssociationMapping(): ?string;

/**
* @param string[] $keys
* Returns the current child admin instance.
*/
public function reorderFormGroup(string $group, array $keys): void;
public function getCurrentChildAdmin(): ?self;

/**
* This method is being called by the main admin class and the child class,
Expand Down
Loading

0 comments on commit 8d49890

Please sign in to comment.