Commit ad7219c2 authored by Alexander Schnitzler's avatar Alexander Schnitzler Committed by Stefan Neufeind
Browse files

[TASK] Replace inject methods with @inject; allow @Flow\Inject

Currently we are using inject methods like:

/*
 * @param $foo Foo
 */
public function injectFoo(Foo $foo) {
	$this->foo = $foo;
}

This patch removes these methods and introduces
property annotations:

/**
 * @var Foo
 * @inject
 */
protected $foo;

Besides that, it allows the use of @Flow\Inject
as well for compatibility to Flow.

Releases: 6.2
Resolves: #46598
Change-Id: Ied219d465dfa8fce24a819a7fc58a2ff8cb5401c
Reviewed-on: https://review.typo3.org/21819
Reviewed-by: Alexander Schnitzler
Tested-by: Alexander Schnitzler
Reviewed-by: Stefan Neufeind
Tested-by: Stefan Neufeind
parent c65383be
......@@ -36,6 +36,7 @@ class HelpCommandController extends \TYPO3\CMS\Extbase\Mvc\Controller\CommandCon
/**
* @var \TYPO3\CMS\Extbase\Mvc\Cli\CommandManager
* @inject
*/
protected $commandManager;
......@@ -44,14 +45,6 @@ class HelpCommandController extends \TYPO3\CMS\Extbase\Mvc\Controller\CommandCon
*/
protected $commandsByExtensionsAndControllers = array();
/**
* @param \TYPO3\CMS\Extbase\Mvc\Cli\CommandManager $commandManager
* @return void
*/
public function injectCommandManager(\TYPO3\CMS\Extbase\Mvc\Cli\CommandManager $commandManager) {
$this->commandManager = $commandManager;
}
/**
* Displays a short, general help message
*
......
......@@ -51,11 +51,13 @@ abstract class AbstractConfigurationManager implements \TYPO3\CMS\Core\Singleton
/**
* @var \TYPO3\CMS\Extbase\Object\ObjectManagerInterface
* @inject
*/
protected $objectManager;
/**
* @var \TYPO3\CMS\Extbase\Service\TypoScriptService
* @inject
*/
protected $typoScriptService;
......@@ -82,33 +84,10 @@ abstract class AbstractConfigurationManager implements \TYPO3\CMS\Core\Singleton
/**
* @var \TYPO3\CMS\Extbase\Service\EnvironmentService
* @inject
*/
protected $environmentService;
/**
* @param \TYPO3\CMS\Extbase\Object\ObjectManagerInterface $objectManager
* @return void
*/
public function injectObjectManager(\TYPO3\CMS\Extbase\Object\ObjectManagerInterface $objectManager) {
$this->objectManager = $objectManager;
}
/**
* @param \TYPO3\CMS\Extbase\Service\TypoScriptService $typoScriptService
* @return void
*/
public function injectTypoScriptService(\TYPO3\CMS\Extbase\Service\TypoScriptService $typoScriptService) {
$this->typoScriptService = $typoScriptService;
}
/**
* @param \TYPO3\CMS\Extbase\Service\EnvironmentService $environmentService
* @return void
*/
public function injectEnvironmentService(\TYPO3\CMS\Extbase\Service\EnvironmentService $environmentService) {
$this->environmentService = $environmentService;
}
/**
* @param \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer $contentObject
* @return void
......
......@@ -33,18 +33,12 @@ namespace TYPO3\CMS\Extbase\Configuration;
class BackendConfigurationManager extends \TYPO3\CMS\Extbase\Configuration\AbstractConfigurationManager {
/**
* @var \TYPO3\CMS\Core\Database\QueryGenerator Needed to recursively fetch a page tree
*/
protected $queryGenerator;
/**
* Inject query generator
* Needed to recursively fetch a page tree
*
* @param \TYPO3\CMS\Core\Database\QueryGenerator $queryGenerator
* @var \TYPO3\CMS\Core\Database\QueryGenerator
* @inject
*/
public function injectQueryGenerator(\TYPO3\CMS\Core\Database\QueryGenerator $queryGenerator) {
$this->queryGenerator = $queryGenerator;
}
protected $queryGenerator;
/**
* @var array
......
......@@ -37,6 +37,7 @@ class ConfigurationManager implements \TYPO3\CMS\Extbase\Configuration\Configura
/**
* @var \TYPO3\CMS\Extbase\Object\ObjectManagerInterface
* @inject
*/
protected $objectManager;
......@@ -47,25 +48,10 @@ class ConfigurationManager implements \TYPO3\CMS\Extbase\Configuration\Configura
/**
* @var \TYPO3\CMS\Extbase\Service\EnvironmentService
* @inject
*/
protected $environmentService;
/**
* @param \TYPO3\CMS\Extbase\Object\ObjectManagerInterface $objectManager
* @return void
*/
public function injectObjectManager(\TYPO3\CMS\Extbase\Object\ObjectManagerInterface $objectManager) {
$this->objectManager = $objectManager;
}
/**
* @param \TYPO3\CMS\Extbase\Service\EnvironmentService $environmentService
* @return void
*/
public function injectEnvironmentService(\TYPO3\CMS\Extbase\Service\EnvironmentService $environmentService) {
$this->environmentService = $environmentService;
}
/**
* Initializes the object
*
......
......@@ -36,17 +36,10 @@ class FrontendConfigurationManager extends \TYPO3\CMS\Extbase\Configuration\Abst
/**
* @var \TYPO3\CMS\Extbase\Service\FlexFormService
* @inject
*/
protected $flexFormService;
/**
* @param \TYPO3\CMS\Extbase\Service\FlexFormService $flexFormService
* @return void
*/
public function injectFlexFormService(\TYPO3\CMS\Extbase\Service\FlexFormService $flexFormService) {
$this->flexFormService = $flexFormService;
}
/**
* Returns TypoScript Setup array from current Environment.
*
......
......@@ -36,6 +36,7 @@ class Command {
/**
* @var \TYPO3\CMS\Extbase\Object\ObjectManagerInterface
* @inject
*/
protected $objectManager;
......@@ -63,8 +64,9 @@ class Command {
* Reflection service
*
* @var \TYPO3\CMS\Extbase\Reflection\ReflectionService
* @inject
*/
private $reflectionService;
protected $reflectionService;
/**
* Constructor
......@@ -90,21 +92,6 @@ class Command {
$this->commandIdentifier = strtolower($extensionKey . ':' . substr($classNameParts[3], 0, -17) . ':' . $controllerCommandName);
}
/**
* @param \TYPO3\CMS\Extbase\Reflection\ReflectionService $reflectionService Reflection service
*/
public function injectReflectionService(\TYPO3\CMS\Extbase\Reflection\ReflectionService $reflectionService) {
$this->reflectionService = $reflectionService;
}
/**
* @param \TYPO3\CMS\Extbase\Object\ObjectManagerInterface $objectManager A reference to the object manager
* @return void
*/
public function injectObjectManager(\TYPO3\CMS\Extbase\Object\ObjectManagerInterface $objectManager) {
$this->objectManager = $objectManager;
}
/**
* @return string
*/
......
......@@ -33,6 +33,7 @@ class CommandManager implements \TYPO3\CMS\Core\SingletonInterface {
/**
* @var \TYPO3\CMS\Extbase\Object\ObjectManagerInterface
* @inject
*/
protected $objectManager;
......@@ -46,14 +47,6 @@ class CommandManager implements \TYPO3\CMS\Core\SingletonInterface {
*/
protected $shortCommandIdentifiers = NULL;
/**
* @param \TYPO3\CMS\Extbase\Object\ObjectManagerInterface $objectManager A reference to the object manager
* @return void
*/
public function injectObjectManager(\TYPO3\CMS\Extbase\Object\ObjectManagerInterface $objectManager) {
$this->objectManager = $objectManager;
}
/**
* Returns an array of all commands
*
......
......@@ -34,6 +34,7 @@ class Request implements \TYPO3\CMS\Extbase\Mvc\RequestInterface {
/**
* @var \TYPO3\CMS\Extbase\Object\ObjectManagerInterface
* @inject
*/
protected $objectManager;
......@@ -81,14 +82,6 @@ class Request implements \TYPO3\CMS\Extbase\Mvc\RequestInterface {
*/
protected $command = NULL;
/**
* @param \TYPO3\CMS\Extbase\Object\ObjectManagerInterface $objectManager A reference to the object manager
* @return void
*/
public function injectObjectManager(\TYPO3\CMS\Extbase\Object\ObjectManagerInterface $objectManager) {
$this->objectManager = $objectManager;
}
/**
* Sets the dispatched flag
*
......
......@@ -33,43 +33,22 @@ class RequestBuilder {
/**
* @var \TYPO3\CMS\Extbase\Object\ObjectManagerInterface
* @inject
*/
protected $objectManager;
/**
* @var \TYPO3\CMS\Extbase\Reflection\ReflectionService
* @inject
*/
protected $reflectionService;
/**
* @var \TYPO3\CMS\Extbase\Mvc\Cli\CommandManager
* @inject
*/
protected $commandManager;
/**
* @param \TYPO3\CMS\Extbase\Object\ObjectManagerInterface $objectManager
* @return void
*/
public function injectObjectManager(\TYPO3\CMS\Extbase\Object\ObjectManagerInterface $objectManager) {
$this->objectManager = $objectManager;
}
/**
* @param \TYPO3\CMS\Extbase\Reflection\ReflectionService $reflectionService
* @return void
*/
public function injectReflectionService(\TYPO3\CMS\Extbase\Reflection\ReflectionService $reflectionService) {
$this->reflectionService = $reflectionService;
}
/**
* @param \TYPO3\CMS\Extbase\Mvc\Cli\CommandManager $commandManager
* @return void
*/
public function injectCommandManager(\TYPO3\CMS\Extbase\Mvc\Cli\CommandManager $commandManager) {
$this->commandManager = $commandManager;
}
/**
* Builds a CLI request object from a command line.
*
......
......@@ -33,56 +33,28 @@ class RequestHandler implements \TYPO3\CMS\Extbase\Mvc\RequestHandlerInterface {
/**
* @var \TYPO3\CMS\Extbase\Object\ObjectManagerInterface
* @inject
*/
protected $objectManager;
/**
* @var \TYPO3\CMS\Extbase\Mvc\Dispatcher
* @inject
*/
protected $dispatcher;
/**
* @var \TYPO3\CMS\Extbase\Mvc\Cli\RequestBuilder
* @inject
*/
protected $requestBuilder;
/**
* @var \TYPO3\CMS\Extbase\Service\EnvironmentService
* @inject
*/
protected $environmentService;
/**
* @param \TYPO3\CMS\Extbase\Object\ObjectManagerInterface $objectManager
* @return void
*/
public function injectObjectManager(\TYPO3\CMS\Extbase\Object\ObjectManagerInterface $objectManager) {
$this->objectManager = $objectManager;
}
/**
* @param \TYPO3\CMS\Extbase\Mvc\Dispatcher $dispatcher
* @return void
*/
public function injectDispatcher(\TYPO3\CMS\Extbase\Mvc\Dispatcher $dispatcher) {
$this->dispatcher = $dispatcher;
}
/**
* @param \TYPO3\CMS\Extbase\Mvc\Cli\RequestBuilder $requestBuilder
* @return void
*/
public function injectRequestBuilder(\TYPO3\CMS\Extbase\Mvc\Cli\RequestBuilder $requestBuilder) {
$this->requestBuilder = $requestBuilder;
}
/**
* @param \TYPO3\CMS\Extbase\Service\EnvironmentService $environmentService
* @return void
*/
public function injectEnvironmentService(\TYPO3\CMS\Extbase\Service\EnvironmentService $environmentService) {
$this->environmentService = $environmentService;
}
/**
* Handles the request
*
......
......@@ -36,6 +36,7 @@ abstract class AbstractController implements \TYPO3\CMS\Extbase\Mvc\Controller\C
/**
* @var \TYPO3\CMS\Extbase\SignalSlot\Dispatcher
* @inject
*/
protected $signalSlotDispatcher;
......@@ -81,11 +82,13 @@ abstract class AbstractController implements \TYPO3\CMS\Extbase\Mvc\Controller\C
/**
* @var \TYPO3\CMS\Extbase\Property\Mapper
* @deprecated since Extbase 1.4.0, will be removed two versions after Extbase 6.1
* @inject
*/
protected $deprecatedPropertyMapper;
/**
* @var \TYPO3\CMS\Extbase\Validation\ValidatorResolver
* @inject
*/
protected $validatorResolver;
......@@ -164,17 +167,6 @@ abstract class AbstractController implements \TYPO3\CMS\Extbase\Mvc\Controller\C
$this->settings = $this->configurationManager->getConfiguration(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::CONFIGURATION_TYPE_SETTINGS);
}
/**
* Injects the property mapper
*
* @param \TYPO3\CMS\Extbase\Property\Mapper $deprecatedPropertyMapper The property mapper
* @return void
* @deprecated since Extbase 1.4.0, will be removed two versions after Extbase 6.1
*/
public function injectDeprecatedPropertyMapper(\TYPO3\CMS\Extbase\Property\Mapper $deprecatedPropertyMapper) {
$this->deprecatedPropertyMapper = $deprecatedPropertyMapper;
}
/**
* Injects the object manager
*
......@@ -186,16 +178,6 @@ abstract class AbstractController implements \TYPO3\CMS\Extbase\Mvc\Controller\C
$this->arguments = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Mvc\\Controller\\Arguments');
}
/**
* Injects the validator resolver
*
* @param \TYPO3\CMS\Extbase\Validation\ValidatorResolver $validatorResolver
* @return void
*/
public function injectValidatorResolver(\TYPO3\CMS\Extbase\Validation\ValidatorResolver $validatorResolver) {
$this->validatorResolver = $validatorResolver;
}
/**
* This method is deprecated! For further information have a look at
* the PhpDoc of class \TYPO3\CMS\Extbase\Mvc\Controller\FlashMessageContainer
......@@ -209,15 +191,6 @@ abstract class AbstractController implements \TYPO3\CMS\Extbase\Mvc\Controller\C
$this->flashMessageContainer = $flashMessageContainer;
}
/**
* Injects the signal slot dispatcher
*
* @param \TYPO3\CMS\Extbase\SignalSlot\Dispatcher $signalSlotDispatcher
*/
public function injectSignalSlotDispatcher(\TYPO3\CMS\Extbase\SignalSlot\Dispatcher $signalSlotDispatcher) {
$this->signalSlotDispatcher = $signalSlotDispatcher;
}
/**
* Checks if the current request type is supported by the controller.
*
......
......@@ -36,11 +36,13 @@ class ActionController extends \TYPO3\CMS\Extbase\Mvc\Controller\AbstractControl
/**
* @var \TYPO3\CMS\Extbase\Reflection\ReflectionService
* @inject
*/
protected $reflectionService;
/**
* @var \TYPO3\CMS\Extbase\Service\CacheService
* @inject
*/
protected $cacheService;
......@@ -106,33 +108,11 @@ class ActionController extends \TYPO3\CMS\Extbase\Mvc\Controller\AbstractControl
/**
* @var \TYPO3\CMS\Extbase\Mvc\Controller\MvcPropertyMappingConfigurationService
* @inject
* @api
*/
protected $mvcPropertyMappingConfigurationService;
/**
* @param \TYPO3\CMS\Extbase\Reflection\ReflectionService $reflectionService
* @return void
*/
public function injectReflectionService(\TYPO3\CMS\Extbase\Reflection\ReflectionService $reflectionService) {
$this->reflectionService = $reflectionService;
}
/**
* @param \TYPO3\CMS\Extbase\Service\CacheService $cacheService
* @return void
*/
public function injectCacheService(\TYPO3\CMS\Extbase\Service\CacheService $cacheService) {
$this->cacheService = $cacheService;
}
/**
* @param \TYPO3\CMS\Extbase\Mvc\Controller\MvcPropertyMappingConfigurationService $mvcPropertyMappingConfigurationService
*/
public function injectMvcPropertyMappingConfigurationService(\TYPO3\CMS\Extbase\Mvc\Controller\MvcPropertyMappingConfigurationService $mvcPropertyMappingConfigurationService) {
$this->mvcPropertyMappingConfigurationService = $mvcPropertyMappingConfigurationService;
}
/**
* Checks if the current request type is supported by the controller.
*
......
......@@ -36,21 +36,25 @@ class Argument {
/**
* @var \TYPO3\CMS\Extbase\Object\ObjectManagerInterface
* @inject
*/
protected $objectManager;
/**
* @var \TYPO3\CMS\Extbase\Persistence\Generic\QueryFactory
* @inject
*/
protected $queryFactory;
/**
* @var \TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface
* @inject
*/
protected $configurationManager;
/**
* This is the old property mapper, which has been completely rewritten for 1.4.
* @inject
*
* @var \TYPO3\CMS\Extbase\Property\Mapper
*/
......@@ -60,11 +64,13 @@ class Argument {
* The new, completely rewritten property mapper since Extbase 1.4.
*
* @var \TYPO3\CMS\Extbase\Property\PropertyMapper
* @inject
*/
protected $propertyMapper;
/**
* @var \TYPO3\CMS\Extbase\Mvc\Controller\MvcPropertyMappingConfiguration
* @inject
*/
protected $propertyMappingConfiguration;
......@@ -164,6 +170,7 @@ class Argument {
/**
* @var \TYPO3\CMS\Extbase\Persistence\PersistenceManagerInterface
* @inject
*/
protected $persistenceManager;
......@@ -186,32 +193,6 @@ class Argument {
$this->dataType = $dataType;
}
/**
* Injects the object manager
*
* @param \TYPO3\CMS\Extbase\Object\ObjectManagerInterface $objectManager
* @return void
*/
public function injectObjectManager(\TYPO3\CMS\Extbase\Object\ObjectManagerInterface $objectManager) {
$this->objectManager = $objectManager;
}
/**
* @param \TYPO3\CMS\Extbase\Property\Mapper $deprecatedPropertyMapper
* @return void
*/
public function injectDeprecatedPropertyMapper(\TYPO3\CMS\Extbase\Property\Mapper $deprecatedPropertyMapper) {
$this->deprecatedPropertyMapper = $deprecatedPropertyMapper;
}
/**
* @param \TYPO3\CMS\Extbase\Property\PropertyMapper $propertyMapper
* @return void
*/
public function injectPropertyMapper(\TYPO3\CMS\Extbase\Property\PropertyMapper $propertyMapper) {
$this->propertyMapper = $propertyMapper;
}
/**
* @param \TYPO3\CMS\Extbase\Reflection\ReflectionService $reflectionService
* @return void
......@@ -222,34 +203,6 @@ class Argument {
$this->dataTypeClassSchema = strpbrk($this->dataType, '_\\') !== FALSE ? $this->reflectionService->getClassSchema($this->dataType) : NULL;
}
/**
* Injects the Persistence Manager
*
* @param \TYPO3\CMS\Extbase\Persistence\PersistenceManagerInterface $persistenceManager
* @return void
*/
public function injectPersistenceManager(\TYPO3\CMS\Extbase\Persistence\PersistenceManagerInterface $persistenceManager) {
$this->persistenceManager = $persistenceManager;
}
/**
* Injects a QueryFactory instance
*
* @param \TYPO3\CMS\Extbase\Persistence\Generic\QueryFactoryInterface $queryFactory
* @return void
*/
public function injectQueryFactory(\TYPO3\CMS\Extbase\Persistence\Generic\QueryFactoryInterface $queryFactory) {
$this->queryFactory = $queryFactory;
}
/**
* @param \TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface $configurationManager
* @return void
*/
public function injectConfigurationManager(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface $configurationManager) {
$this->configurationManager = $configurationManager;
}
/**
* @param \TYPO3\CMS\Extbase\Service\TypeHandlingService $typeHandlingService
* @return void
......@@ -259,14 +212,6 @@ class Argument {
$this->dataType = $this->typeHandlingService->normalizeType($this->dataType);
}
/**
* @param \TYPO3\CMS\Extbase\Mvc\Controller\MvcPropertyMappingConfiguration $mvcPropertyMappingConfiguration
* @return void
*/
public function injectPropertyMappingConfiguration(\TYPO3\CMS\Extbase\Mvc\Controller\MvcPropertyMappingConfiguration $mvcPropertyMappingConfiguration) {
$this->propertyMappingConfiguration = $mvcPropertyMappingConfiguration;
}
/**
* Returns the name of this argument
*
......
......@@ -34,6 +34,7 @@ class Arguments extends \ArrayObject {
/**
* @var \TYPO3\CMS\Extbase\Object\ObjectManagerInterface
* @inject
*/
protected $objectManager;
......@@ -54,16 +55,6 @@ class Arguments extends \ArrayObject {
parent::__construct();