Skip to content

Commit

Permalink
Deprecate Pool::setTemplateRegistry (#6794)
Browse files Browse the repository at this point in the history
  • Loading branch information
franmomu committed Jan 21, 2021
1 parent c422007 commit 8a48504
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 3 deletions.
7 changes: 7 additions & 0 deletions UPGRADE-3.x.md
@@ -1,6 +1,13 @@
UPGRADE 3.x
===========

UPGRADE FROM 3.xx to 3.xx
=========================

### Deprecated `Sonata\AdminBundle\Admin\Pool::setTemplateRegistry()` method.

This method has been deprecated without replacement.

UPGRADE FROM 3.86 to 3.87
=========================

Expand Down
15 changes: 13 additions & 2 deletions src/Admin/Pool.php
Expand Up @@ -117,7 +117,9 @@ class Pool
protected $propertyAccessor;

/**
* NEXT_MAJOR: change to TemplateRegistryInterface.
* NEXT_MAJOR: Remove this property.
*
* @deprecated since sonata-project/admin-bundle 3.x and will be removed in 4.0.
*
* @var MutableTemplateRegistryInterface
*/
Expand Down Expand Up @@ -649,10 +651,19 @@ public function getAdminClasses()
}

/**
* NEXT_MAJOR: change to TemplateRegistryInterface.
* NEXT_MAJOR: Remove this method.
*
* @deprecated since sonata-project/admin-bundle 3.x and will be removed in 4.0.
*/
final public function setTemplateRegistry(MutableTemplateRegistryInterface $templateRegistry): void
{
if ('sonata_deprecation_mute' !== (\func_get_args()[1] ?? null)) {
@trigger_error(sprintf(
'The "%s()" method is deprecated since version 3.x and will be removed in 4.0.',
__METHOD__,
), \E_USER_DEPRECATED);
}

$this->templateRegistry = $templateRegistry;
}

Expand Down
2 changes: 2 additions & 0 deletions src/Resources/config/core.php
Expand Up @@ -56,8 +56,10 @@
[], // admin service groups
[], // admin service classes
])
// NEXT_MAJOR: Remove this call.
->call('setTemplateRegistry', [
new ReferenceConfigurator('sonata.admin.global_template_registry'),
'sonata_deprecation_mute',
])

->alias(Pool::class, 'sonata.admin.pool')
Expand Down
1 change: 0 additions & 1 deletion tests/Action/DashboardActionTest.php
Expand Up @@ -42,7 +42,6 @@ protected function setUp(): void
$this->templateRegistry = $this->createStub(MutableTemplateRegistryInterface::class);

$pool = new Pool($container);
$pool->setTemplateRegistry($this->templateRegistry);

$twig = $this->createMock(Environment::class);

Expand Down

0 comments on commit 8a48504

Please sign in to comment.