Commit b3429ca9 authored by Tomas Norre Mikkelsen's avatar Tomas Norre Mikkelsen

Merge branch 'removeInitializeController' into 'develop'

Remove initialize controller

See merge request !256
parents a5ba811e 41a2b9da
Pipeline #2559 passed with stages
in 3 minutes and 7 seconds
......@@ -57,22 +57,8 @@ abstract class AbstractController extends \TYPO3\CMS\Extbase\Mvc\Controller\Acti
throw new \Exception('Static template "Default Configuration" of ter_fe2 has to be inserted before this plugin can be shown in frontend');
}
$this->settings = \T3o\TerFe2\Utility\TypoScript::parse($this->settings);
// Initialize the controller
$this->initializeController();
}
/**
* Override in concrete controller to initialize it
*
* @return void
*/
protected function initializeController()
{
}
/**
* Translate a label
*
......
......@@ -25,12 +25,13 @@ namespace T3o\TerFe2\Controller;
* This copyright notice MUST APPEAR in all copies of the script!
******************************************************************/
use TYPO3\CMS\Extbase\Persistence\Generic\QuerySettingsInterface;
/**
* Controller for the extension object
*/
class ExtensionController extends \T3o\TerFe2\Controller\AbstractController
{
/**
* @var \T3o\TerFe2\Domain\Repository\ExtensionRepository
*/
......@@ -46,6 +47,11 @@ class ExtensionController extends \T3o\TerFe2\Controller\AbstractController
*/
protected $versionRepository;
/**
* @var \TYPO3\CMS\Extbase\Domain\Repository\FrontendUserRepository
*/
protected $ownerRepository;
/**
* @var \T3o\TerFe2\Provider\ProviderManager
*/
......@@ -62,33 +68,99 @@ class ExtensionController extends \T3o\TerFe2\Controller\AbstractController
protected $persistenceManager;
/**
* @var \TYPO3\CMS\Extbase\Domain\Repository\FrontendUserRepository
* @var array
*/
protected $ownerRepository;
protected $frontendUser;
/**
* @var array
* inject extensionRepository
*
* @param \T3o\TerFe2\Domain\Repository\ExtensionRepository $extensionRepository
* @return void
*/
protected $frontendUser;
public function injectExtensionRepository(\T3o\TerFe2\Domain\Repository\ExtensionRepository $extensionRepository)
{
$this->extensionRepository = $extensionRepository;
}
/**
* Initializes the controller
* inject tagRepository
*
* @param \T3o\TerFe2\Domain\Repository\TagRepository $tagRepository
* @return void
*/
protected function initializeController()
public function injectTagRepository(\T3o\TerFe2\Domain\Repository\TagRepository $tagRepository)
{
$this->extensionRepository = $this->objectManager->get(\T3o\TerFe2\Domain\Repository\ExtensionRepository::class);
$this->tagRepository = $this->objectManager->get(\T3o\TerFe2\Domain\Repository\TagRepository::class);
$this->versionRepository = $this->objectManager->get(\T3o\TerFe2\Domain\Repository\VersionRepository::class);
$this->ownerRepository = $this->objectManager->get(\TYPO3\CMS\Extbase\Domain\Repository\FrontendUserRepository::class);
$this->tagRepository = $tagRepository;
}
/**
* inject versionRepository
*
* @param \T3o\TerFe2\Domain\Repository\VersionRepository $versionRepository
* @return void
*/
public function injectVersionRepository(\T3o\TerFe2\Domain\Repository\VersionRepository $versionRepository)
{
$this->versionRepository = $versionRepository;
}
/**
* inject ownerRepository
*
* @param \TYPO3\CMS\Extbase\Domain\Repository\FrontendUserRepository $ownerRepository
* @return void
*/
public function injectOwnerRepository(\TYPO3\CMS\Extbase\Domain\Repository\FrontendUserRepository $ownerRepository)
{
/** @var QuerySettingsInterface $querySettings */
$querySettings = $this->objectManager->get(\TYPO3\CMS\Extbase\Persistence\Generic\QuerySettingsInterface::class);
$querySettings->setRespectStoragePage(false);
$this->ownerRepository = $ownerRepository;
$this->ownerRepository->setDefaultQuerySettings($querySettings);
$this->providerManager = $this->objectManager->get(\T3o\TerFe2\Provider\ProviderManager::class);
$this->session = $this->objectManager->get(\T3o\TerFe2\Persistence\Session::class);
$this->persistenceManager = $this->objectManager->get(\TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager::class);
}
/**
* inject providerManager
*
* @param \T3o\TerFe2\Provider\ProviderManager $providerManager
* @return void
*/
public function injectProviderManager(\T3o\TerFe2\Provider\ProviderManager $providerManager)
{
$this->providerManager = $providerManager;
}
/**
* inject session
*
* @param \T3o\TerFe2\Persistence\Session $session
* @return void
*/
public function injectSession(\T3o\TerFe2\Persistence\Session $session)
{
$this->session = $session;
}
/**
* inject persistenceManager
*
* @param \TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager $persistenceManager
* @return void
*/
public function injectPersistenceManager(\TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager $persistenceManager)
{
$this->persistenceManager = $persistenceManager;
}
/**
* Initializes this object after all injects were done
*
* @return void
*/
protected function initializeObject()
{
// Show insecure extensions only for reviewers
$this->extensionRepository->setShowInsecure($this->securityRole->isReviewer());
$this->versionRepository->setShowInsecure($this->securityRole->isReviewer());
......
......@@ -29,6 +29,7 @@ namespace T3o\TerFe2\Controller;
use ApacheSolrForTypo3\Solr\IndexQueue\Queue;
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Persistence\Generic\QuerySettingsInterface;
/**
* Controller for the extension key registration
......@@ -52,17 +53,40 @@ class RegisterkeyController extends \T3o\TerFe2\Controller\AbstractTerBasedContr
protected $userRepository;
/**
* Initializes the controller
* inject extensionRepository
*
* @param \T3o\TerFe2\Domain\Repository\ExtensionRepository $extensionRepository
* @return void
*/
protected function initializeController()
public function injectExtensionRepository(\T3o\TerFe2\Domain\Repository\ExtensionRepository $extensionRepository)
{
$this->extensionRepository = $this->objectManager->get(\T3o\TerFe2\Domain\Repository\ExtensionRepository::class);
$this->versionRepository = $this->objectManager->get(\T3o\TerFe2\Domain\Repository\VersionRepository::class);
$this->userRepository = $this->objectManager->get(\TYPO3\CMS\Extbase\Domain\Repository\FrontendUserRepository::class);
$this->extensionRepository = $extensionRepository;
}
/**
* inject versionRepository
*
* @param \T3o\TerFe2\Domain\Repository\VersionRepository $versionRepository
* @return void
*/
public function injectVersionRepository(\T3o\TerFe2\Domain\Repository\VersionRepository $versionRepository)
{
$this->versionRepository = $versionRepository;
}
/**
* inject userRepository
*
* @param \TYPO3\CMS\Extbase\Domain\Repository\FrontendUserRepository $userRepository
* @return void
*/
public function injectUserRepository(\TYPO3\CMS\Extbase\Domain\Repository\FrontendUserRepository $userRepository)
{
/** @var QuerySettingsInterface $querySettings */
$querySettings = $this->objectManager->get(\TYPO3\CMS\Extbase\Persistence\Generic\QuerySettingsInterface::class);
$querySettings->setRespectStoragePage(false);
$this->userRepository = $userRepository;
$this->userRepository->setDefaultQuerySettings($querySettings);
}
......
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