Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
VincentLanglet committed Dec 16, 2020
1 parent 8d49890 commit d4f8f03
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 24 deletions.
25 changes: 4 additions & 21 deletions src/Admin/AbstractAdmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Datagrid\ProxyQueryInterface;
use Sonata\AdminBundle\DependencyInjection\Admin\AbstractTaggedAdmin;
use Sonata\AdminBundle\Exporter\DataSourceInterface;
use Sonata\AdminBundle\Form\FormMapper;
use Sonata\AdminBundle\Form\Type\ModelHiddenType;
use Sonata\AdminBundle\Manipulator\ObjectManipulator;
Expand Down Expand Up @@ -381,20 +380,9 @@ public function getDataSourceIterator(): SourceIteratorInterface
// $fields[$key] = $field;
}

if ($this->getDataSource()) {
$query = $datagrid->getQuery();
$query = $datagrid->getQuery();

return $this->getDataSource()->createIterator($query, $fields);
}

@trigger_error(sprintf(
'Using "%s()" without setting a "%s" instance in the admin is deprecated since sonata-project/admin-bundle 3.79'
.' and won\'t be possible in 4.0.',
__METHOD__,
DataSourceInterface::class
), E_USER_DEPRECATED);

return $this->getModelManager()->getDataSourceIterator($datagrid, $fields);
return $this->getDataSource()->createIterator($query, $fields);
}

/**
Expand Down Expand Up @@ -819,11 +807,6 @@ public function getIdParameter(): string

public function hasRoute(string $name): bool
{
// NEXT_MAJOR: Remove this check.
if (!$this->routeGenerator) {
throw new \RuntimeException('RouteGenerator cannot be null');
}

return $this->getRouteGenerator()->hasAdminRoute($this, $name);
}

Expand Down Expand Up @@ -860,12 +843,12 @@ public function generateObjectUrl(string $name, object $object, array $parameter

public function generateUrl(string $name, array $parameters = [], int $referenceType = RoutingUrlGeneratorInterface::ABSOLUTE_PATH): string
{
return $this->routeGenerator->generateUrl($this, $name, $parameters, $referenceType);
return $this->getRouteGenerator()->generateUrl($this, $name, $parameters, $referenceType);
}

public function generateMenuUrl(string $name, array $parameters = [], int $referenceType = RoutingUrlGeneratorInterface::ABSOLUTE_PATH): array
{
return $this->routeGenerator->generateMenuUrl($this, $name, $parameters, $referenceType);
return $this->getRouteGenerator()->generateMenuUrl($this, $name, $parameters, $referenceType);
}

final public function setTemplateRegistry(MutableTemplateRegistryInterface $templateRegistry): void
Expand Down
4 changes: 2 additions & 2 deletions src/DependencyInjection/Admin/AbstractTaggedAdmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ public function getManagerType(): string
/**
* @final since sonata-admin/admin-bundle 3.x
*
* @param array<string, string[]|string> $information
* @param array<string, string[]> $information
*/
public function setSecurityInformation(array $information): void
{
Expand All @@ -264,7 +264,7 @@ public function setSecurityInformation(array $information): void
/**
* @final since sonata-admin/admin-bundle 3.x
*
* @return array<string, string[]|string>
* @return array<string, string[]>
*/
public function getSecurityInformation(): array
{
Expand Down
2 changes: 2 additions & 0 deletions src/Security/Handler/AclSecurityHandlerInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ public function addObjectOwner(MutableAclInterface $acl, ?UserSecurityIdentity $

/**
* Add the object class ACE's to the object ACL.
*
* @param array<string, string[]> $roleInformation
*/
public function addObjectClassAces(MutableAclInterface $acl, array $roleInformation = []): void;

Expand Down
2 changes: 1 addition & 1 deletion src/Security/Handler/SecurityHandlerInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function isGranted(AdminInterface $admin, $attributes, ?object $object =
public function getBaseRole(AdminInterface $admin): string;

/**
* @return array<string, mixed>
* @return array<string, string[]>
*/
public function buildSecurityInformation(AdminInterface $admin): array;

Expand Down
3 changes: 3 additions & 0 deletions src/Util/AdminObjectAclData.php
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,9 @@ public function getSecurityHandler(): AclSecurityHandlerInterface
return $securityHandler;
}

/**
* @return array<string, string[]>
*/
public function getSecurityInformation(): array
{
return $this->getSecurityHandler()->buildSecurityInformation($this->admin);
Expand Down

0 comments on commit d4f8f03

Please sign in to comment.