Commit 2c71d063 authored by Kevin Ditscheid's avatar Kevin Ditscheid

[TASK] Remove ObjectManager usages

parent 35e57b9e
......@@ -30,9 +30,10 @@ use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Core\Context\Context;
use TYPO3\CMS\Core\Context\Exception\AspectNotFoundException;
use TYPO3\CMS\Core\Context\WorkspaceAspect;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Persistence\Generic\Query;
use TYPO3\CMS\Extbase\Persistence\QueryInterface;
use TYPO3\CMS\Frontend\Page\PageRepository;
use TYPO3\CMS\Core\Domain\Repository\PageRepository;
use TYPO3\CMS\Extbase\Persistence\Generic\Qom;
use TYPO3\CMS\Extbase\Persistence\Generic\QuerySettingsInterface;
use TYPO3\Languagevisibility\Service\FrontendServices;
......@@ -67,9 +68,8 @@ class Typo3DbBackend extends \TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo
return $rows;
}
$context = $this->objectManager->get(Context::class);
$pageRepository = $this->objectManager->get(PageRepository::class, $context);
$context = GeneralUtility::makeInstance(Context::class);
$pageRepository = GeneralUtility::makeInstance(PageRepository::class, $context);
$overlaidRows = [];
foreach ($rows as $row) {
......@@ -192,16 +192,16 @@ class Typo3DbBackend extends \TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo
return $rows;
}
$context = $this->objectManager->get(Context::class);
$context = GeneralUtility::makeInstance(Context::class);
if ($workspaceUid === NULL) {
$workspaceUid = $context->getPropertyFromAspect('workspace', 'id');
} else {
// A custom query is needed, so a custom context is cloned
$workspaceUid = (int) $workspaceUid;
$context = clone $context;
$context->setAspect('workspace', $this->objectManager->get(WorkspaceAspect::class, $workspaceUid));
$context->setAspect('workspace', GeneralUtility::makeInstance(WorkspaceAspect::class, $workspaceUid));
}
$pageRepository = $this->objectManager->get(PageRepository::class, $context);
$pageRepository = GeneralUtility::makeInstance(PageRepository::class, $context);
// Fetches the move-placeholder in case it is supported
// by the table and if there's only one row in the result set
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment