---
title: "Deprecation: AccessRegistry methods"
manual: "DeepL Translate (CORE)"
version: "main"
permalink: "https://docs.typo3.org/permalink/web-vision/deepltranslate-core:deprecation-accessregistry-methods-1777019642@main"
source: "Changelog/6.0/Deprecation-AccessRegistryMethods.rst"
rendered: "2026-10-06T14:40:53+00:00"
---

# Deprecation: `AccessRegistry` methods {#deprecation-accessregistry-methods-1777019642}

## Description {#description}

Following `\WebVision\Deepltranslate\Core\Access\AccessRegistry` methods
has been deprecated:

-   `addAccess()` because access items are gathered based on the
    `\WebVision\Deepltranslate\Core\Access\AccessItemInterface`
    and added through the constructor by the DI container. Calling this method
    does not add anything and emits now a `E_USER_DEPRECATED` error.
-   `getAllAccess()` is now deprecated and triggers a `E_USER_DEPRECATED`
    error. Use `getItems()` instead.
-   `getAccess()` is now deprecated and triggers a `E_USER_DEPRECATED`
    error. Use `get()` instead.
-   `hasAccess()` is now deprecated and triggers a `E_USER_DEPRECATED`
    error. Use `has()` instead.

## Impact {#impact}

Calling deprecated `\WebVision\Deepltranslate\Core\Access\AccessRegistry`
methods triggers a `E_USER_DEPRECATED` error.

## Affected installations {#affected-installations}

All installations that call one of the deprecated
`\WebVision\Deepltranslate\Core\Access\AccessRegistry` methods triggers a
`E_USER_DEPRECATED` error. Use the above mentioned replacements or remove
the `addAccess()` calls in `ext_localconf.php`.

## Migration {#migration}

### addAccess() {#addaccess}

To register additional `\WebVision\Deepltranslate\Core\Access\AccessItemInterface`
the approach have been to provide following code in `EXT:my_ext/ext_localconf.php`:

**EXT:my_ext/ext_localconf.php**

```php
<?php

use TYPO3\CMS\Core\Utility\GeneralUtility;
use WebVision\Deepltranslate\Core\Access\AccessRegistry;

$accessRegistry = GeneralUtility::makeInstance(AccessRegistry::class);
$accessRegistry->addAccess(new CustomAccessItem());
```

This is no longer required and does not do anything except triggering an
`E_USER_DEPRECATED` error and can be simply removed.

In case dual extension version support is required encapsulate it into a
condition, for example:

**EXT:my_ext/ext_localconf.php**

```php
<?php

use TYPO3\CMS\Core\Utility\GeneralUtility;
use WebVision\Deepltranslate\Core\Access\AccessRegistry;
use WebVision\Deepltranslate\Core\TranslatorInterface;

// @todo web-vision/deepltranslate-core:>=6.0.0 Remove complete condition
//       block once lowest supported deepltranslate-core extension version
//       has been raised to 6.0.0 or higher.
if (class_exists(TranslatorInterface::class) === false) {
    $accessRegistry = GeneralUtility::makeInstance(AccessRegistry::class);
    $accessRegistry->addAccess(new CustomAccessItem());
}
```

### getAllAccess() {#getallaccess}

`getAllAccess()` can be replaced simply using the new `get()` method:

**EXT:my_ext/Classes/SomeClass.php**

```diff
 <?php

 namespace MyVendor\MyExt;

 final class SomeClass {
     public function __construct(
         private AccessRegistry $accessRegistry,
     ) {}

     public function someMethod(): void
     {
-       $allRegisteredAccessItems = $this->accessRegistry->getAllAccess();
+       // `getItems()` returns now the identifiers as keys and `array_values()`
+       // ensures to deal only with the items like with previous `getAllAccess()`.
+       $allRegisteredAccessItems = array_values($this->accessRegistry->getItems());

         foreach($allRegisteredAccessItems as $accessItem) {
             // ... do something with the access item
         }
     }
 }
```

### hasAccess(), getAccess() {#hasaccess-getaccess}

Deprecated `hasAccess()` and `getAccess()` can be simply replaced by their
new counter methods based on the now used `\Psr\Container\ContainerInterface`:

**EXT:my_ext/Classes/SomeClass.php**

```diff
 <?php

 namespace MyVendor\MyExt;

 final class SomeClass {
     public function __construct(
         private AccessRegistry $accessRegistry,
     ) {}

     public function hasAccess(): bool
     {
        $accessIdentifier = '';
-       if (!$this->accessRegistry->hasAccess($accessIdentifier)) {
+       if (!$this->accessRegistry->has($accessIdentifier)) {
          // access does not exists, take this as allowed.
          return true;
        }

-       $accessItem = $this->accessRegistry->getAccess($accessIdentifier);
+       $accessItem = $this->accessRegistry->get($accessIdentifier);
        return $this->getBackendUserAuthentication()->check(
            'custom_options',
            sprintf('deepltranslate:%s', $accessItem->getIdentifier()),
        );
     }

     private function getBackendUserAuthentication(): BackendUserAuthentication
     {
         return $GLOBALS['BE_USER'];
     }
 }
```
