diff --git a/Classes/Domain/Index/TcaIndexer/PagesIndexer.php b/Classes/Domain/Index/TcaIndexer/PagesIndexer.php index d77465f..1718cb8 100644 --- a/Classes/Domain/Index/TcaIndexer/PagesIndexer.php +++ b/Classes/Domain/Index/TcaIndexer/PagesIndexer.php @@ -27,12 +27,18 @@ use Codappix\SearchCore\Domain\Index\TcaIndexer; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Core\Utility\RootlineUtility; use TYPO3\CMS\Extbase\Object\ObjectManager; +use TYPO3\CMS\Extbase\Object\ObjectManagerInterface; /** * Specific indexer for Pages, will basically add content of page. */ class PagesIndexer extends TcaIndexer { + /** + * @var ObjectManagerInterface + */ + protected $objectManager; + /** * @var TcaTableServiceInterface */ @@ -44,20 +50,16 @@ class PagesIndexer extends TcaIndexer */ protected $fileRepository; - /** - * @param TcaTableServiceInterface $tcaTableService - * @param TcaTableServiceInterface $contentTableService - * @param ConnectionInterface $connection - * @param ConfigurationContainerInterface $configuration - */ public function __construct( TcaTableServiceInterface $tcaTableService, TcaTableServiceInterface $contentTableService, ConnectionInterface $connection, - ConfigurationContainerInterface $configuration + ConfigurationContainerInterface $configuration, + ObjectManagerInterface $objectManager ) { parent::__construct($tcaTableService, $connection, $configuration); $this->contentTableService = $contentTableService; + $this->objectManager = $objectManager; } protected function prepareRecord(array &$record) @@ -141,8 +143,7 @@ class PagesIndexer extends TcaIndexer protected function fetchAccess(int $uid, array $pageAccess): array { try { - $objectManager = GeneralUtility::makeInstance(ObjectManager::class); - $rootline = $objectManager->get(RootlineUtility::class, $uid)->get(); + $rootline = $this->objectManager->get(RootlineUtility::class, $uid)->get(); } catch (\RuntimeException $e) { $this->logger->notice( sprintf('Could not fetch rootline for page %u, because: %s', $uid, $e->getMessage()),