Commit cb92653f authored by Marc Bastian Heinrichs's avatar Marc Bastian Heinrichs Committed by Andreas Wolf
Browse files

[TASK] Replace ObjectManager create with get

Since Extbase ObjectManager::create is deprecated replace all
usages of the create method with get.

Change-Id: If6658a7620303ccdb88394f31a1b5685a18ecbca
Resolves: #45333
Releases: 6.1
Reviewed-on: https://review.typo3.org/18174
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
Reviewed-by: Andreas Wolf
Tested-by: Andreas Wolf
parent 086b8acf
......@@ -56,7 +56,7 @@ class ExtensionRepository extends \TYPO3\CMS\Extbase\Persistence\Repository {
$emconfPath = PATH_site . $extension['siteRelPath'] . 'ext_emconf.php';
if (file_exists($emconfPath)) {
include $emconfPath;
$extension = $this->objectManager->create('TYPO3\\CMS\\About\\Domain\\Model\\Extension');
$extension = $this->objectManager->get('TYPO3\\CMS\\About\\Domain\\Model\\Extension');
$extension->setKey($extensionKey);
$extension->setTitle($EM_CONF['']['title']);
$extension->setAuthor($EM_CONF['']['author']);
......
......@@ -127,7 +127,7 @@ abstract class AbstractController extends \TYPO3\CMS\Extbase\Mvc\Controller\Acti
if ($constraint === NULL) {
$constraint = $this->getConstraintFromBeUserData();
if ($constraint === NULL) {
$constraint = $this->objectManager->create('TYPO3\\CMS\\Belog\\Domain\\Model\\Constraint');
$constraint = $this->objectManager->get('TYPO3\\CMS\\Belog\\Domain\\Model\\Constraint');
}
} else {
$this->persistConstraintInBeUserData($constraint);
......
......@@ -40,7 +40,7 @@ class HistoryEntryRepository extends \TYPO3\CMS\Extbase\Persistence\Repository {
*/
public function initializeObject() {
/** @var $querySettings \TYPO3\CMS\Extbase\Persistence\Generic\QuerySettingsInterface */
$querySettings = $this->objectManager->create('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\QuerySettingsInterface');
$querySettings = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\QuerySettingsInterface');
$querySettings->setRespectStoragePage(FALSE);
$this->setDefaultQuerySettings($querySettings);
}
......
......@@ -47,7 +47,7 @@ class LogEntryRepository extends \TYPO3\CMS\Extbase\Persistence\Repository {
public function initializeObject() {
$this->beUserList = \TYPO3\CMS\Backend\Utility\BackendUtility::getUserNames();
/** @var $defaultQuerySettings \TYPO3\CMS\Extbase\Persistence\Generic\QuerySettingsInterface */
$defaultQuerySettings = $this->objectManager->create('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\QuerySettingsInterface');
$defaultQuerySettings = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\QuerySettingsInterface');
$defaultQuerySettings->setRespectStoragePage(FALSE);
$this->setDefaultQuerySettings($defaultQuerySettings);
}
......
......@@ -42,7 +42,7 @@ class WorkspaceRepository extends \TYPO3\CMS\Extbase\Persistence\Repository {
*/
public function initializeObject() {
/** @var $querySettings \TYPO3\CMS\Extbase\Persistence\Generic\QuerySettingsInterface */
$querySettings = $this->objectManager->create('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\QuerySettingsInterface');
$querySettings = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\QuerySettingsInterface');
$querySettings->setRespectStoragePage(FALSE);
$this->setDefaultQuerySettings($querySettings);
}
......
......@@ -38,7 +38,7 @@ class HistoryEntryRepositoryTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestC
public function setUp() {
$this->querySettings = $this->getMock('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\QuerySettingsInterface');
$this->objectManager = $this->getMock('TYPO3\\CMS\\Extbase\\Object\\ObjectManagerInterface');
$this->objectManager->expects($this->any())->method('create')->with('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\QuerySettingsInterface')->will($this->returnValue($this->querySettings));
$this->objectManager->expects($this->any())->method('get')->with('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\QuerySettingsInterface')->will($this->returnValue($this->querySettings));
}
public function tearDown() {
......
......@@ -38,7 +38,7 @@ class LogEntryRepositoryTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase
public function setUp() {
$this->querySettings = $this->getMock('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\QuerySettingsInterface');
$this->objectManager = $this->getMock('TYPO3\\CMS\\Extbase\\Object\\ObjectManagerInterface');
$this->objectManager->expects($this->any())->method('create')->with('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\QuerySettingsInterface')->will($this->returnValue($this->querySettings));
$this->objectManager->expects($this->any())->method('get')->with('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\QuerySettingsInterface')->will($this->returnValue($this->querySettings));
}
public function tearDown() {
......
......@@ -38,7 +38,7 @@ class WorkspaceRepositoryTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase
public function setUp() {
$this->querySettings = $this->getMock('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\QuerySettingsInterface');
$this->objectManager = $this->getMock('TYPO3\\CMS\\Extbase\\Object\\ObjectManagerInterface');
$this->objectManager->expects($this->any())->method('create')->with('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\QuerySettingsInterface')->will($this->returnValue($this->querySettings));
$this->objectManager->expects($this->any())->method('get')->with('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\QuerySettingsInterface')->will($this->returnValue($this->querySettings));
}
public function tearDown() {
......
......@@ -53,7 +53,7 @@ class ModuleDataStorageService implements \TYPO3\CMS\Core\SingletonInterface {
public function loadModuleData() {
$moduleData = $GLOBALS['BE_USER']->getModuleData(self::KEY);
if (empty($moduleData) || !$moduleData) {
$moduleData = $this->objectManager->create('TYPO3\\CMS\\Beuser\\Domain\\Model\\ModuleData');
$moduleData = $this->objectManager->get('TYPO3\\CMS\\Beuser\\Domain\\Model\\ModuleData');
} else {
$moduleData = @unserialize($moduleData);
}
......
......@@ -45,7 +45,7 @@ class UpdateScriptController extends \TYPO3\CMS\Extensionmanager\Controller\Abst
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('Request for update script', 'extensionmanager', 0, $extensionKey);
/** @var $updateScriptUtility \TYPO3\CMS\Extensionmanager\Utility\UpdateScriptUtility */
$updateScriptUtility = $this->objectManager->create('TYPO3\\CMS\\Extensionmanager\\Utility\\UpdateScriptUtility');
$updateScriptUtility = $this->objectManager->get('TYPO3\\CMS\\Extensionmanager\\Utility\\UpdateScriptUtility');
$updateScriptResult = $updateScriptUtility->executeUpdateIfNeeded($extensionKey);
$this->view
->assign('updateScriptResult', $updateScriptResult)
......
......@@ -57,7 +57,7 @@ class ExtensionRepository extends \TYPO3\CMS\Extbase\Persistence\Repository {
*/
public function initializeObject() {
/** @var $defaultQuerySettings \TYPO3\CMS\Extbase\Persistence\Generic\QuerySettingsInterface */
$defaultQuerySettings = $this->objectManager->create('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\QuerySettingsInterface');
$defaultQuerySettings = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\QuerySettingsInterface');
$defaultQuerySettings->setRespectStoragePage(FALSE);
$this->setDefaultQuerySettings($defaultQuerySettings);
$this->databaseConnection = $GLOBALS['TYPO3_DB'];
......
......@@ -37,7 +37,7 @@ class RepositoryRepository extends \TYPO3\CMS\Extbase\Persistence\Repository {
*/
public function initializeObject() {
/** @var $defaultQuerySettings \TYPO3\CMS\Extbase\Persistence\Generic\QuerySettingsInterface */
$defaultQuerySettings = $this->objectManager->create('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\QuerySettingsInterface');
$defaultQuerySettings = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\QuerySettingsInterface');
$defaultQuerySettings->setRespectStoragePage(FALSE);
$this->setDefaultQuerySettings($defaultQuerySettings);
}
......
......@@ -127,7 +127,7 @@ class ConfigurationUtility implements \TYPO3\CMS\Core\SingletonInterface {
if (strlen($rawConfigurationString) > 0) {
$extensionPathInformation = $GLOBALS['TYPO3_LOADED_EXT'][$extensionKey];
$tsStyleConfig = $this->objectManager->create('TYPO3\\CMS\\Core\\TypoScript\\ConfigurationForm');
$tsStyleConfig = $this->objectManager->get('TYPO3\\CMS\\Core\\TypoScript\\ConfigurationForm');
$tsStyleConfig->doNotSortCategoriesBeforeMakingForm = TRUE;
$theConstants = $tsStyleConfig->ext_initTSstyleConfig(
......
......@@ -152,7 +152,7 @@ class DependencyUtility implements \TYPO3\CMS\Core\SingletonInterface {
$highest = '';
}
/** @var $dependencyObject \TYPO3\CMS\Extensionmanager\Domain\Model\Dependency */
$dependencyObject = $this->objectManager->create('TYPO3\\CMS\\Extensionmanager\\Domain\\Model\\Dependency');
$dependencyObject = $this->objectManager->get('TYPO3\\CMS\\Extensionmanager\\Domain\\Model\\Dependency');
$dependencyObject->setType($dependencyType);
$dependencyObject->setIdentifier($dependency);
$dependencyObject->setLowestVersion($lowest);
......
......@@ -56,7 +56,7 @@ class UpdateScriptViewHelper extends \TYPO3\CMS\Fluid\ViewHelpers\Link\ActionVie
// If the "class.ext_update.php" file exists, build link to the update script screen
/** @var $updateScriptUtility \TYPO3\CMS\Extensionmanager\Utility\UpdateScriptUtility */
$updateScriptUtility = $this->objectManager->create('TYPO3\\CMS\\Extensionmanager\\Utility\\UpdateScriptUtility');
$updateScriptUtility = $this->objectManager->get('TYPO3\\CMS\\Extensionmanager\\Utility\\UpdateScriptUtility');
if ($updateScriptUtility->checkUpdateScriptExists($extensionKey)) {
$uriBuilder = $this->controllerContext->getUriBuilder();
$action = 'show';
......
......@@ -87,7 +87,7 @@ class ConfigurationUtilityTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCas
$configurationUtility->_set('objectManager', $objectManagerMock);
$objectManagerMock
->expects($this->once())
->method('create')
->method('get')
->with('TYPO3\\CMS\\Core\\TypoScript\\ConfigurationForm')
->will($this->returnValue($tsStyleConfig));
......
......@@ -44,9 +44,9 @@ class DependencyUtilityTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
));
/** @var $dependencyUtility \TYPO3\CMS\Extensionmanager\Utility\DependencyUtility */
$dependencyUtility = $this->getAccessibleMock('TYPO3\\CMS\\Extensionmanager\\Utility\\DependencyUtility', array('dummy'));
$objectManagerMock = $this->getAccessibleMock('TYPO3\\CMS\\Extbase\\Object\\ObjectManager', array('create'));
$objectManagerMock = $this->getAccessibleMock('TYPO3\\CMS\\Extbase\\Object\\ObjectManager', array('get'));
$dependencyModelMock = $this->getAccessibleMock('TYPO3\\CMS\\Extensionmanager\\Domain\\Model\\Dependency', array('dummy'));
$objectManagerMock->expects($this->any())->method('create')->will($this->returnValue($dependencyModelMock));
$objectManagerMock->expects($this->any())->method('get')->will($this->returnValue($dependencyModelMock));
$dependencyUtility->_set('objectManager', $objectManagerMock);
$objectStorage = $dependencyUtility->convertDependenciesToObjects($serializedDependencies);
$this->assertTrue($objectStorage instanceof \SplObjectStorage);
......@@ -66,9 +66,9 @@ class DependencyUtilityTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
));
/** @var $dependencyUtility \TYPO3\CMS\Extensionmanager\Utility\DependencyUtility */
$dependencyUtility = $this->getAccessibleMock('TYPO3\\CMS\\Extensionmanager\\Utility\\DependencyUtility', array('dummy'));
$objectManagerMock = $this->getAccessibleMock('TYPO3\\CMS\\Extbase\\Object\\ObjectManager', array('create'));
$objectManagerMock = $this->getAccessibleMock('TYPO3\\CMS\\Extbase\\Object\\ObjectManager', array('get'));
$dependencyModelMock = $this->getAccessibleMock('TYPO3\\CMS\\Extensionmanager\\Domain\\Model\\Dependency', array('setIdentifier'));
$objectManagerMock->expects($this->any())->method('create')->will($this->returnValue($dependencyModelMock));
$objectManagerMock->expects($this->any())->method('get')->will($this->returnValue($dependencyModelMock));
$dependencyUtility->_set('objectManager', $objectManagerMock);
$dependencyModelMock->expects($this->at(0))->method('setIdentifier')->with('php');
$dependencyModelMock->expects($this->at(1))->method('setIdentifier')->with('typo3');
......@@ -139,9 +139,9 @@ class DependencyUtilityTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
$serializedDependencies = serialize($dependencyString);
/** @var $dependencyUtility \TYPO3\CMS\Extensionmanager\Utility\DependencyUtility */
$dependencyUtility = $this->getAccessibleMock('TYPO3\\CMS\\Extensionmanager\\Utility\\DependencyUtility', array('dummy'));
$objectManagerMock = $this->getAccessibleMock('TYPO3\\CMS\\Extbase\\Object\\ObjectManager', array('create'));
$objectManagerMock = $this->getAccessibleMock('TYPO3\\CMS\\Extbase\\Object\\ObjectManager', array('get'));
$dependencyModelMock = $this->getAccessibleMock('TYPO3\\CMS\\Extensionmanager\\Domain\\Model\\Dependency', array('setHighestVersion', 'setLowestVersion'));
$objectManagerMock->expects($this->any())->method('create')->will($this->returnValue($dependencyModelMock));
$objectManagerMock->expects($this->any())->method('get')->will($this->returnValue($dependencyModelMock));
$dependencyUtility->_set('objectManager', $objectManagerMock);
$dependencyModelMock->expects($this->atLeastOnce())->method('setLowestVersion')->with($this->identicalTo($returnValue[0]));
$dependencyModelMock->expects($this->atLeastOnce())->method('setHighestVersion')->with($this->identicalTo($returnValue[1]));
......
......@@ -88,7 +88,7 @@ class LanguageController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionControl
$actionName = $this->request->getControllerActionName();
if (in_array($actionName, $this->jsonActions)) {
$viewObjectName = 'TYPO3\\CMS\\Lang\\View\\Language\\' . ucfirst($actionName) . 'Json';
$this->view = $this->objectManager->create($viewObjectName);
$this->view = $this->objectManager->get($viewObjectName);
$this->view->setControllerContext($this->controllerContext);
$this->view->initializeView();
}
......@@ -105,7 +105,7 @@ class LanguageController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionControl
*/
public function indexAction(\TYPO3\CMS\Lang\Domain\Model\LanguageSelectionForm $languageSelectionForm = NULL, $extensions = NULL) {
if ($languageSelectionForm === NULL) {
$languageSelectionForm = $this->objectManager->create('TYPO3\\CMS\\Lang\\Domain\\Model\\LanguageSelectionForm');
$languageSelectionForm = $this->objectManager->get('TYPO3\\CMS\\Lang\\Domain\\Model\\LanguageSelectionForm');
$languageSelectionForm->setLanguages($this->languageRepository->findAll());
$languageSelectionForm->setSelectedLanguages($this->languageRepository->findSelected());
}
......
......@@ -79,7 +79,7 @@ class ExtensionRepository {
foreach ($availableAndInstalledExtensions as $entry) {
/** @var $extension \TYPO3\CMS\Lang\Domain\Model\Extension */
$extension = $this->objectManager->create(
$extension = $this->objectManager->get(
'TYPO3\CMS\Lang\Domain\Model\Extension',
$entry['key'],
$entry['title'],
......
......@@ -106,7 +106,7 @@ class LanguageRepository {
$label = htmlspecialchars($language);
}
$this->languages[$locale] = $this->objectManager->create(
$this->languages[$locale] = $this->objectManager->get(
'TYPO3\CMS\Lang\Domain\Model\Language',
$locale,
$label,
......
Supports Markdown
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