Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate Pool::setTemplateRegistry #6794

Merged
merged 1 commit into from
Jan 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions UPGRADE-3.x.md
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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