Skip to content

Commit

Permalink
[TASK:T12] Remove/Replace `TYPO3\CMS\Extbase\Mvc\Controller\Controlle…
Browse files Browse the repository at this point in the history
…rContext`

Fixes: TYPO3-Solr#3511
Relates: TYPO3-Solr#3376
  • Loading branch information
dkd-kaehm committed Jun 1, 2023
1 parent d9e4f9d commit 95f40f5
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 20 deletions.
22 changes: 22 additions & 0 deletions Classes/Controller/AbstractBaseController.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,28 @@ public function setResetConfigurationBeforeInitialize(bool $resetConfigurationBe
$this->resetConfigurationBeforeInitialize = $resetConfigurationBeforeInitialize;
}

/**
* Initialize the controller context
*
* @return SolrControllerContext ControllerContext to be passed to the view
* @api
*/
protected function buildControllerContext(): SolrControllerContext
{
/** @var $controllerContext SolrControllerContext */
$controllerContext = GeneralUtility::makeInstance(SolrControllerContext::class);
// $controllerContext->setRequest($this->request);
// $controllerContext->setResponse($this->response);
// if ($this->arguments !== null) {
// $controllerContext->setArguments($this->arguments);
// }
// $controllerContext->setUriBuilder($this->uriBuilder);

$controllerContext->setTypoScriptConfiguration($this->typoScriptConfiguration);

return $controllerContext;
}

/**
* Initialize action
*/
Expand Down
11 changes: 3 additions & 8 deletions Classes/Task/IndexQueueWorkerTaskAdditionalFieldProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,9 @@
*/
class IndexQueueWorkerTaskAdditionalFieldProvider extends AbstractAdditionalFieldProvider
{
/**
* SiteRepository
*/
protected SiteRepository $siteRepository;

public function __construct()
{
$this->siteRepository = GeneralUtility::makeInstance(SiteRepository::class);
public function __construct(
protected readonly SiteRepository $siteRepository
) {
}

/**
Expand Down
6 changes: 5 additions & 1 deletion Configuration/Services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ services:
event: TYPO3\CMS\Backend\View\Event\PageContentPreviewRenderingEvent
# END: BE modules

viewhelper_backend:
viewHelpers_backend:
namespace: ApacheSolrForTypo3\Solr\ViewHelpers\Backend\
resource: '../Classes/ViewHelpers/Backend/*'
public: true
Expand Down Expand Up @@ -204,6 +204,10 @@ services:
- name: event.listener
identifier: 'solr.index.FrontendHelper.PageIndexer.indexPageContentAfterCacheableContentIsGenerated'
event: TYPO3\CMS\Frontend\Event\AfterCacheableContentIsGeneratedEvent
ApacheSolrForTypo3\Solr\Task\IndexQueueWorkerTaskAdditionalFieldProvider:
public: true
arguments:
$siteRepository: '@ApacheSolrForTypo3\Solr\Domain\Site\SiteRepository'

### EXT:solr content objects
ApacheSolrForTypo3\Solr\ContentObject\Classification:
Expand Down
25 changes: 14 additions & 11 deletions ext_localconf.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

use ApacheSolrForTypo3\Solr\GarbageCollector;
use ApacheSolrForTypo3\Solr\IndexQueue\RecordMonitor;
use ApacheSolrForTypo3\Solr\Controller\SearchController;
use ApacheSolrForTypo3\Solr\IndexQueue\FrontendHelper\Manager as FrontendHelperManager;
use TYPO3\CMS\Extbase\Utility\ExtensionUtility;

defined('TYPO3') or die('Access denied.');

Expand All @@ -23,12 +26,12 @@
// registering Index Queue page indexer helpers
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['solr']['Indexer']['indexPageSubstitutePageDocument'][\ApacheSolrForTypo3\Solr\AdditionalFieldsIndexer::class] = \ApacheSolrForTypo3\Solr\AdditionalFieldsIndexer::class;

\ApacheSolrForTypo3\Solr\IndexQueue\FrontendHelper\Manager::registerFrontendHelper(
FrontendHelperManager::registerFrontendHelper(
'findUserGroups',
\ApacheSolrForTypo3\Solr\IndexQueue\FrontendHelper\UserGroupDetector::class
);

\ApacheSolrForTypo3\Solr\IndexQueue\FrontendHelper\Manager::registerFrontendHelper(
FrontendHelperManager::registerFrontendHelper(
'indexPage',
\ApacheSolrForTypo3\Solr\IndexQueue\FrontendHelper\PageIndexer::class
);
Expand Down Expand Up @@ -210,37 +213,37 @@

// ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- #

\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
ExtensionUtility::configurePlugin(
'Solr',
'pi_results',
[
\ApacheSolrForTypo3\Solr\Controller\SearchController::class => 'results,form,detail',
SearchController::class => 'results,form,detail',
],
[
\ApacheSolrForTypo3\Solr\Controller\SearchController::class => 'results',
SearchController::class => 'results',
]
);

\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
ExtensionUtility::configurePlugin(
'Solr',
'pi_search',
[
\ApacheSolrForTypo3\Solr\Controller\SearchController::class => 'form',
SearchController::class => 'form',
]
);

\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
ExtensionUtility::configurePlugin(
'Solr',
'pi_frequentlySearched',
[
\ApacheSolrForTypo3\Solr\Controller\SearchController::class => 'frequentlySearched',
SearchController::class => 'frequentlySearched',
],
[
\ApacheSolrForTypo3\Solr\Controller\SearchController::class => 'frequentlySearched',
SearchController::class => 'frequentlySearched',
]
);

\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
ExtensionUtility::configurePlugin(
'Solr',
'pi_suggest',
[
Expand Down

0 comments on commit 95f40f5

Please sign in to comment.