Commit 590c3a4b authored by Benni Mack's avatar Benni Mack Committed by Wouter Wolters
Browse files

[TASK] Cleanup code imports for all workspaces classes

The system extension workspaces was never touched in terms of
checking if actually methods are needed, and a lot of code still uses
FQDN instead of the "use" keyword for a PHP class.

Some unused dependencies (e.g. to Extbase's objectmanager) are
removed as well.

Resolves: #84136
Releases: master
Change-Id: Ifa71ce9dddb6d0e68e09ee969d217d1514105a1a
Reviewed-on: https://review.typo3.org/56006


Tested-by: default avatarTYPO3com <no-reply@typo3.com>
Reviewed-by: Georg Ringer's avatarGeorg Ringer <georg.ringer@gmail.com>
Tested-by: Georg Ringer's avatarGeorg Ringer <georg.ringer@gmail.com>
Reviewed-by: default avatarStefan Neufeind <typo3.neufeind@speedpartner.de>
Tested-by: default avatarStefan Neufeind <typo3.neufeind@speedpartner.de>
Reviewed-by: default avatarJoerg Boesche <typo3@joergboesche.de>
Reviewed-by: Wouter Wolters's avatarWouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters's avatarWouter Wolters <typo3@wouterwolters.nl>
parent f3d273d6
......@@ -14,6 +14,7 @@ namespace TYPO3\CMS\Workspaces\Backend\ToolbarItems;
* The TYPO3 project - inspiring people to share!
*/
use TYPO3\CMS\Backend\Routing\UriBuilder;
use TYPO3\CMS\Backend\Toolbar\ToolbarItemInterface;
use TYPO3\CMS\Core\Page\PageRenderer;
use TYPO3\CMS\Core\Utility\GeneralUtility;
......@@ -78,8 +79,7 @@ class WorkspaceSelectorToolbarItem implements ToolbarItemInterface
$backendUser = $this->getBackendUser();
$view = $this->getFluidTemplateObject('DropDown.html');
$activeWorkspace = (int)$backendUser->workspace;
/** @var \TYPO3\CMS\Backend\Routing\UriBuilder $uriBuilder */
$uriBuilder = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Routing\UriBuilder::class);
$uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
foreach ($this->availableWorkspaces as $workspaceId => $label) {
$workspaceId = (int)$workspaceId;
$item = [
......
......@@ -17,8 +17,10 @@ namespace TYPO3\CMS\Workspaces\Controller;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
use TYPO3\CMS\Core\Http\JsonResponse;
use TYPO3\CMS\Core\Type\Bitmask\Permission;
use TYPO3\CMS\Workspaces\Service\WorkspaceService;
/**
* Implements the AJAX functionality for the various asynchronous calls
......@@ -65,7 +67,7 @@ class AjaxController
}
$ajaxResponse = [
'title' => \TYPO3\CMS\Workspaces\Service\WorkspaceService::getWorkspaceTitle($workspaceId),
'title' => WorkspaceService::getWorkspaceTitle($workspaceId),
'workspaceId' => $workspaceId,
'pageId' => ($finalPageUid && $originalPageId == $finalPageUid) ? null : $finalPageUid
];
......@@ -73,7 +75,7 @@ class AjaxController
}
/**
* @return \TYPO3\CMS\Core\Authentication\BackendUserAuthentication
* @return BackendUserAuthentication
*/
protected function getBackendUser()
{
......
......@@ -42,7 +42,7 @@ class AjaxDispatcher
*/
public function dispatch(ServerRequestInterface $request): ResponseInterface
{
$callStack = \GuzzleHttp\json_decode($request->getBody()->getContents());
$callStack = json_decode($request->getBody()->getContents());
if (!is_array($callStack)) {
$callStack = [$callStack];
}
......
......@@ -26,6 +26,7 @@ use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Fluid\View\StandaloneView;
use TYPO3\CMS\Workspaces\Service\StagesService;
use TYPO3\CMS\Workspaces\Service\WorkspaceService;
use TYPO3Fluid\Fluid\View\ViewInterface;
/**
* Implements the preview controller of the workspace module.
......@@ -55,7 +56,7 @@ class PreviewController
protected $moduleTemplate;
/**
* @var \TYPO3Fluid\Fluid\View\ViewInterface
* @var ViewInterface
*/
protected $view;
......
......@@ -14,6 +14,12 @@ namespace TYPO3\CMS\Workspaces\Controller\Remote;
* The TYPO3 project - inspiring people to share!
*/
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\MathUtility;
use TYPO3\CMS\Workspaces\Domain\Model\CombinedRecord;
use TYPO3\CMS\Workspaces\Service\IntegrityService;
use TYPO3\CMS\Workspaces\Service\WorkspaceService;
/**
* Class AbstractHandler
*/
......@@ -53,11 +59,11 @@ abstract class AbstractHandler
/**
* Gets an instance of the workspaces service.
*
* @return \TYPO3\CMS\Workspaces\Service\WorkspaceService
* @return WorkspaceService
*/
protected function getWorkspaceService()
{
return \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Workspaces\Service\WorkspaceService::class);
return GeneralUtility::makeInstance(WorkspaceService::class);
}
/**
......@@ -70,7 +76,7 @@ abstract class AbstractHandler
protected function validateLanguageParameter(\stdClass $parameters)
{
$language = null;
if (isset($parameters->language) && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($parameters->language)) {
if (isset($parameters->language) && MathUtility::canBeInterpretedAsInteger($parameters->language)) {
$language = $parameters->language;
}
return $language;
......@@ -90,13 +96,13 @@ abstract class AbstractHandler
$affectedElements = [];
if ($parameters->type === 'selection') {
foreach ((array)$parameters->selection as $element) {
$affectedElements[] = \TYPO3\CMS\Workspaces\Domain\Model\CombinedRecord::create($element->table, $element->liveId, $element->versionId);
$affectedElements[] = CombinedRecord::create($element->table, $element->liveId, $element->versionId);
}
} elseif ($parameters->type === 'all') {
$versions = $this->getWorkspaceService()->selectVersionsInWorkspace($this->getCurrentWorkspace(), 0, -99, -1, 0, 'tables_select', $this->validateLanguageParameter($parameters));
foreach ($versions as $table => $tableElements) {
foreach ($tableElements as $element) {
$affectedElement = \TYPO3\CMS\Workspaces\Domain\Model\CombinedRecord::create($table, $element['t3ver_oid'], $element['uid']);
$affectedElement = CombinedRecord::create($table, $element['t3ver_oid'], $element['uid']);
$affectedElement->getVersionRecord()->setRow($element);
$affectedElements[] = $affectedElement;
}
......@@ -109,14 +115,13 @@ abstract class AbstractHandler
* Creates a new instance of the integrity service for the
* given set of affected elements.
*
* @param \TYPO3\CMS\Workspaces\Domain\Model\CombinedRecord[] $affectedElements
* @return \TYPO3\CMS\Workspaces\Service\IntegrityService
* @param CombinedRecord[] $affectedElements
* @return IntegrityService
* @see getAffectedElements
*/
protected function createIntegrityService(array $affectedElements)
{
/** @var $integrityService \TYPO3\CMS\Workspaces\Service\IntegrityService */
$integrityService = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Workspaces\Service\IntegrityService::class);
$integrityService = GeneralUtility::makeInstance(IntegrityService::class);
$integrityService->setAffectedElements($affectedElements);
return $integrityService;
}
......
......@@ -15,8 +15,12 @@ namespace TYPO3\CMS\Workspaces\Controller\Remote;
*/
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
use TYPO3\CMS\Core\DataHandling\DataHandler;
use TYPO3\CMS\Core\Exception;
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\MathUtility;
use TYPO3\CMS\Fluid\View\StandaloneView;
use TYPO3\CMS\Workspaces\Domain\Record\StageRecord;
use TYPO3\CMS\Workspaces\Domain\Record\WorkspaceRecord;
......@@ -216,7 +220,7 @@ class ActionHandler extends AbstractHandler
*/
public function saveLanguageSelection($language)
{
if (\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($language) === false && $language !== 'all') {
if (MathUtility::canBeInterpretedAsInteger($language) === false && $language !== 'all') {
$language = 'all';
}
$GLOBALS['BE_USER']->uc['moduleData']['Workspaces'][$GLOBALS['BE_USER']->workspace]['language'] = $language;
......@@ -362,7 +366,7 @@ class ActionHandler extends AbstractHandler
}
if ($stageRecord->hasPreselection() && !$stageRecord->isPreselectionChangeable()) {
$preselectedBackendUsers = $this->getStageService()->getBackendUsers(
$preselectedBackendUsers = $this->stageService->getBackendUsers(
implode(',', $this->stageService->getPreselectedRecipients($stageRecord))
);
......@@ -411,12 +415,9 @@ class ActionHandler extends AbstractHandler
public function discardStagesFromPage($pageId)
{
$cmdMapArray = [];
/** @var $workspaceService WorkspaceService */
$workspaceService = GeneralUtility::makeInstance(WorkspaceService::class);
/** @var $stageService StagesService */
$stageService = GeneralUtility::makeInstance(StagesService::class);
$workspaceItemsArray = $workspaceService->selectVersionsInWorkspace(
$stageService->getWorkspaceId(),
$this->stageService->getWorkspaceId(),
$filter = 1,
$stage = -99,
$pageId,
......@@ -453,7 +454,7 @@ class ActionHandler extends AbstractHandler
$cmdMapArray = [];
$comment = $parameters->comments;
$stageId = $parameters->stageId;
if (\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($stageId) === false) {
if (MathUtility::canBeInterpretedAsInteger($stageId) === false) {
throw new \InvalidArgumentException('Missing "stageId" in $parameters array.', 1319488194);
}
if (!is_object($parameters->affects) || empty($parameters->affects)) {
......@@ -500,8 +501,7 @@ class ActionHandler extends AbstractHandler
return $result;
}
/** @var \TYPO3\CMS\Core\DataHandling\DataHandler $dataHandler */
$dataHandler = GeneralUtility::makeInstance(\TYPO3\CMS\Core\DataHandling\DataHandler::class);
$dataHandler = GeneralUtility::makeInstance(DataHandler::class);
$dataHandler->start([], $cmdMapArray);
$dataHandler->process_cmdmap();
......@@ -694,7 +694,7 @@ class ActionHandler extends AbstractHandler
}
$result = [];
$allRecipients = $this->getStageService()->getResponsibleBeUser($stageRecord);
$allRecipients = $this->stageService->getResponsibleBeUser($stageRecord);
$preselectedRecipients = $this->stageService->getPreselectedRecipients($stageRecord);
$isPreselectionChangeable = $stageRecord->isPreselectionChangeable();
......@@ -727,23 +727,10 @@ class ActionHandler extends AbstractHandler
*/
protected function getDefaultCommentOfStage($stage)
{
$result = $this->getStageService()->getPropertyOfCurrentWorkspaceStage($stage, 'default_mailcomment');
$result = $this->stageService->getPropertyOfCurrentWorkspaceStage($stage, 'default_mailcomment');
return $result;
}
/**
* Gets an instance of the Stage service.
*
* @return StagesService
*/
protected function getStageService()
{
if (!isset($this->stageService)) {
$this->stageService = GeneralUtility::makeInstance(StagesService::class);
}
return $this->stageService;
}
/**
* Send all available workspace records to the previous stage.
*
......@@ -761,7 +748,7 @@ class ActionHandler extends AbstractHandler
$recursionLevel = 0,
$selectionType = 'tables_modify'
);
list($currentStage, $previousStage) = $this->getStageService()->getPreviousStageForElementCollection($workspaceItemsArray);
list($currentStage, $previousStage) = $this->stageService->getPreviousStageForElementCollection($workspaceItemsArray);
// get only the relevant items for processing
$workspaceItemsArray = $workspaceService->selectVersionsInWorkspace(
$this->stageService->getWorkspaceId(),
......@@ -796,7 +783,7 @@ class ActionHandler extends AbstractHandler
$recursionLevel = 0,
$selectionType = 'tables_modify'
);
list($currentStage, $nextStage) = $this->getStageService()->getNextStageForElementCollection($workspaceItemsArray);
list($currentStage, $nextStage) = $this->stageService->getNextStageForElementCollection($workspaceItemsArray);
// get only the relevant items for processing
$workspaceItemsArray = $workspaceService->selectVersionsInWorkspace(
$this->stageService->getWorkspaceId(),
......@@ -823,9 +810,7 @@ class ActionHandler extends AbstractHandler
*/
public function updateStageChangeButtons($id)
{
/** @var StagesService $stageService */
$stageService = GeneralUtility::makeInstance(StagesService::class);
/** @var WorkspaceService $workspaceService */
$workspaceService = GeneralUtility::makeInstance(WorkspaceService::class);
// fetch the next and previous stage
$workspaceItemsArray = $workspaceService->selectVersionsInWorkspace(
......@@ -839,7 +824,6 @@ class ActionHandler extends AbstractHandler
list(, $nextStage) = $stageService->getNextStageForElementCollection($workspaceItemsArray);
list(, $previousStage) = $stageService->getPreviousStageForElementCollection($workspaceItemsArray);
/** @var StandaloneView $view */
$view = GeneralUtility::makeInstance(StandaloneView::class);
$extensionPath = ExtensionManagementUtility::extPath('workspaces');
$view->setPartialRootPaths(['default' => $extensionPath . 'Resources/Private/Partials']);
......@@ -862,7 +846,7 @@ class ActionHandler extends AbstractHandler
/**
* @param int $workspaceId
* @return int Id of the original workspace
* @throws \TYPO3\CMS\Core\Exception
* @throws Exception
*/
protected function setTemporaryWorkspace($workspaceId)
{
......@@ -871,7 +855,7 @@ class ActionHandler extends AbstractHandler
if ($currentWorkspace !== $workspaceId) {
if (!$this->getBackendUser()->setTemporaryWorkspace($workspaceId)) {
throw new \TYPO3\CMS\Core\Exception(
throw new Exception(
'Cannot set temporary workspace to "' . $workspaceId . '"',
1371484524
);
......@@ -882,7 +866,7 @@ class ActionHandler extends AbstractHandler
}
/**
* @return \TYPO3\CMS\Core\Authentication\BackendUserAuthentication
* @return BackendUserAuthentication
*/
protected function getBackendUser()
{
......
......@@ -14,6 +14,8 @@ namespace TYPO3\CMS\Workspaces\Controller\Remote;
* The TYPO3 project - inspiring people to share!
*/
use TYPO3\CMS\Workspaces\Service\WorkspaceService;
/**
* Class MassActionHandler
* Class encapsulates all actions which are triggered for all elements within the current workspace.
......@@ -41,7 +43,7 @@ class MassActionHandler extends AbstractHandler
$currentWorkspace = $this->getCurrentWorkspace();
$massActionsEnabled = $GLOBALS['BE_USER']->getTSConfigVal('options.workspaces.enableMassActions') !== '0';
// in case we're working within "All Workspaces" we can't provide Mass Actions
if ($currentWorkspace != \TYPO3\CMS\Workspaces\Service\WorkspaceService::SELECT_ALL_WORKSPACES && $massActionsEnabled) {
if ($currentWorkspace != WorkspaceService::SELECT_ALL_WORKSPACES && $massActionsEnabled) {
$publishAccess = $GLOBALS['BE_USER']->workspacePublishAccess($currentWorkspace);
if ($publishAccess && !($GLOBALS['BE_USER']->workspaceRec['publish_access'] & 1)) {
$actions[] = ['action' => 'publish', 'title' => $GLOBALS['LANG']->sL($this->pathToLocallang . ':label_doaction_publish')];
......@@ -49,7 +51,7 @@ class MassActionHandler extends AbstractHandler
$actions[] = ['action' => 'swap', 'title' => $GLOBALS['LANG']->sL($this->pathToLocallang . ':label_doaction_swap')];
}
}
if ($currentWorkspace !== \TYPO3\CMS\Workspaces\Service\WorkspaceService::LIVE_WORKSPACE_ID) {
if ($currentWorkspace !== WorkspaceService::LIVE_WORKSPACE_ID) {
$actions[] = ['action' => 'discard', 'title' => $GLOBALS['LANG']->sL($this->pathToLocallang . ':label_doaction_discard')];
}
}
......
......@@ -27,7 +27,6 @@ use TYPO3\CMS\Core\Resource\ProcessedFile;
use TYPO3\CMS\Core\Utility\DiffUtility;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\MathUtility;
use TYPO3\CMS\Extbase\Object\ObjectManager;
use TYPO3\CMS\Extbase\Utility\LocalizationUtility;
use TYPO3\CMS\Workspaces\Service\GridDataService;
use TYPO3\CMS\Workspaces\Service\HistoryService;
......@@ -119,7 +118,6 @@ class RemoteServer extends AbstractHandler
$diffReturnArray = [];
$liveReturnArray = [];
$diffUtility = $this->getDifferenceHandler();
/** @var $parseObj RteHtmlParser */
$parseObj = GeneralUtility::makeInstance(RteHtmlParser::class);
$liveRecord = BackendUtility::getRecord($parameter->table, $parameter->t3ver_oid);
$versionRecord = BackendUtility::getRecord($parameter->table, $parameter->uid);
......@@ -504,12 +502,4 @@ class RemoteServer extends AbstractHandler
}
return $this->differenceHandler;
}
/**
* @return \TYPO3\CMS\Extbase\Object\ObjectManager
*/
protected function getObjectManager()
{
return GeneralUtility::makeInstance(ObjectManager::class);
}
}
......@@ -145,7 +145,6 @@ class ReviewController extends ActionController
$backendUser = $this->getBackendUser();
$moduleTemplate = $this->view->getModuleTemplate();
/** @var WorkspaceService $wsService */
$wsService = GeneralUtility::makeInstance(WorkspaceService::class);
if (GeneralUtility::_GP('id')) {
$pageRecord = BackendUtility::getRecord('pages', GeneralUtility::_GP('id'));
......@@ -324,7 +323,6 @@ class ReviewController extends ActionController
$this->uriBuilder->reset()->uriFor('fullIndex');
$parameters = array_merge($parameters, $this->uriBuilder->getArguments());
}
/** @var UriBuilder $uriBuilder */
$uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
return (string)$uriBuilder->buildUriFromRoute('web_WorkspacesWorkspaces', $parameters);
}
......
......@@ -15,8 +15,15 @@ namespace TYPO3\CMS\Workspaces\DataHandler;
*/
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Core\DataHandling\DataHandler;
use TYPO3\CMS\Core\Utility\ArrayUtility;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\MathUtility;
use TYPO3\CMS\Workspaces\Dependency\DependencyResolver;
use TYPO3\CMS\Workspaces\Dependency\ElementEntity;
use TYPO3\CMS\Workspaces\Dependency\ElementEntityProcessor;
use TYPO3\CMS\Workspaces\Dependency\EventCallback;
use TYPO3\CMS\Workspaces\Hook\DataHandlerHook;
/**
* Handles the \TYPO3\CMS\Core\DataHandling\DataHandler command map and is
......@@ -36,12 +43,12 @@ class CommandMap
const KEY_TransformDependentElementsToUseLiveId = 'KEY_TransformDependentElementsToUseLiveId';
/**
* @var \TYPO3\CMS\Workspaces\Hook\DataHandlerHook
* @var DataHandlerHook
*/
protected $parent;
/**
* @var \TYPO3\CMS\Core\DataHandling\DataHandler
* @var DataHandler
*/
protected $tceMain;
......@@ -71,19 +78,19 @@ class CommandMap
protected $scopes;
/**
* @var \TYPO3\CMS\Workspaces\Dependency\ElementEntityProcessor
* @var ElementEntityProcessor
*/
protected $elementEntityProcessor;
/**
* Creates this object.
*
* @param \TYPO3\CMS\Workspaces\Hook\DataHandlerHook $parent
* @param \TYPO3\CMS\Core\DataHandling\DataHandler $tceMain
* @param DataHandlerHook $parent
* @param DataHandler $tceMain
* @param array $commandMap
* @param int $workspace
*/
public function __construct(\TYPO3\CMS\Workspaces\Hook\DataHandlerHook $parent, \TYPO3\CMS\Core\DataHandling\DataHandler $tceMain, array $commandMap, $workspace)
public function __construct(DataHandlerHook $parent, DataHandler $tceMain, array $commandMap, $workspace)
{
$this->setParent($parent);
$this->setTceMain($tceMain);
......@@ -108,7 +115,7 @@ class CommandMap
* Sets the command map.
*
* @param array $commandMap
* @return \TYPO3\CMS\Workspaces\DataHandler\CommandMap
* @return CommandMap
*/
public function set(array $commandMap)
{
......@@ -119,7 +126,7 @@ class CommandMap
/**
* Gets the parent object.
*
* @return \TYPO3\CMS\Workspaces\Hook\DataHandlerHook
* @return DataHandlerHook
*/
public function getParent()
{
......@@ -129,10 +136,10 @@ class CommandMap
/**
* Sets the parent object.
*
* @param \TYPO3\CMS\Workspaces\Hook\DataHandlerHook $parent
* @return \TYPO3\CMS\Workspaces\DataHandler\CommandMap
* @param DataHandlerHook $parent
* @return CommandMap
*/
public function setParent(\TYPO3\CMS\Workspaces\Hook\DataHandlerHook $parent)
public function setParent(DataHandlerHook $parent)
{
$this->parent = $parent;
return $this;
......@@ -141,7 +148,7 @@ class CommandMap
/**
* Gets the parent object.
*
* @return \TYPO3\CMS\Core\DataHandling\DataHandler
* @return DataHandler
*/
public function getTceMain()
{
......@@ -151,10 +158,10 @@ class CommandMap
/**
* Sets the parent object.
*
* @param \TYPO3\CMS\Core\DataHandling\DataHandler $tceMain
* @return \TYPO3\CMS\Workspaces\DataHandler\CommandMap
* @param DataHandler $tceMain
* @return CommandMap
*/
public function setTceMain(\TYPO3\CMS\Core\DataHandling\DataHandler $tceMain)
public function setTceMain(DataHandler $tceMain)
{
$this->tceMain = $tceMain;
return $this;
......@@ -185,7 +192,7 @@ class CommandMap
* (see options.workspaces.swapMode).
*
* @param string $workspacesSwapMode
* @return \TYPO3\CMS\Workspaces\DataHandler\CommandMap
* @return CommandMap
*/
public function setWorkspacesSwapMode($workspacesSwapMode)
{
......@@ -198,7 +205,7 @@ class CommandMap
* see options.workspaces.changeStageMode)
*
* @param string $workspacesChangeStageMode
* @return \TYPO3\CMS\Workspaces\DataHandler\CommandMap
* @return CommandMap
*/
public function setWorkspacesChangeStageMode($workspacesChangeStageMode)
{
......@@ -209,14 +216,12 @@ class CommandMap
/**
* Gets the element entity processor.
*
* @return \TYPO3\CMS\Workspaces\Dependency\ElementEntityProcessor
* @return ElementEntityProcessor
*/
protected function getElementEntityProcessor()
{
if (!isset($this->elementEntityProcessor)) {
$this->elementEntityProcessor = GeneralUtility::makeInstance(
\TYPO3\CMS\Workspaces\Dependency\ElementEntityProcessor::class
);
$this->elementEntityProcessor = GeneralUtility::makeInstance(ElementEntityProcessor::class);
$this->elementEntityProcessor->setWorkspace($this->getWorkspace());
}
return $this->elementEntityProcessor;
......@@ -225,7 +230,7 @@ class CommandMap
/**
* Processes the command map.
*
* @return \TYPO3\CMS\Workspaces\DataHandler\CommandMap
* @return CommandMap
*/
public function process()
{
......@@ -248,7 +253,7 @@ class CommandMap
foreach ($liveIdCollection as $liveId => $commandCollection) {
foreach ($commandCollection as $command => $properties) {
if ($command === 'version' && isset($properties['action']) && $properties['action'] === 'swap') {
if (isset($properties['swapWith']) && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($properties['swapWith'])) {
if (isset($properties['swapWith']) && MathUtility::canBeInterpretedAsInteger($properties['swapWith'])) {
call_user_func_array([$this, $callbackMethod], array_merge($arguments, [$table, $liveId, $properties]));
}
}
......@@ -303,12 +308,12 @@ class CommandMap
/**
* Adds workspaces elements for swapping/publishing.
*
* @param \TYPO3\CMS\Workspaces\Dependency\DependencyResolver $dependency
* @param DependencyResolver $dependency
* @param string $table
* @param int $liveId
* @param array $properties
*/
protected function addWorkspacesSwapElements(\TYPO3\CMS\Workspaces\Dependency\DependencyResolver $dependency, $table, $liveId, array $properties)
protected function addWorkspacesSwapElements(DependencyResolver $dependency, $table, $liveId, array $properties)
{
$elementList = [];
// Fetch accordant elements if the swapMode is 'any' or 'pages':
......@@ -338,7 +343,7 @@ class CommandMap
foreach ($versionIdCollection as $versionIdList => $commandCollection) {
foreach ($commandCollection as $command => $properties) {
if ($command === 'version' && isset($properties['action']) && $properties['action'] === 'setStage') {
if (isset($properties['stageId']) && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($properties['stageId'])) {
if (isset($properties['stageId']) && MathUtility::canBeInterpretedAsInteger($properties['stageId'])) {
call_user_func_array([$this, $callbackMethod], array_merge($arguments, [$table, $versionIdList, $properties]));
}
}
......@@ -408,12 +413,12 @@ class CommandMap
/**
* Adds workspaces elements for staging.
*
* @param \TYPO3\CMS\Workspaces\Dependency\DependencyResolver $dependency
* @param DependencyResolver $dependency
* @param string $table
* @param string $versionId
* @param array $properties
*/
protected function addWorkspacesSetStageElements(\TYPO3\CMS\Workspaces\Dependency\DependencyResolver $dependency, $table, $versionId, array $properties)
protected function addWorkspacesSetStageElements(DependencyResolver $dependency, $table, $versionId, array $properties)
{
$dependency->addElement($table, $versionId, ['versionId' => $versionId, 'properties' => $properties]);
}
......@@ -468,10 +473,10 @@ class CommandMap
* Applies the workspaces dependencies and removes incomplete structures or automatically
* completes them
*
* @param \TYPO3\CMS\Workspaces\Dependency\DependencyResolver $dependency
* @param DependencyResolver $dependency
* @param string $scope
*/
protected function applyWorkspacesDependencies(\TYPO3\CMS\Workspaces\Dependency\DependencyResolver $dependency, $scope)
protected function applyWorkspacesDependencies(DependencyResolver $dependency, $scope)
{
$transformDependentElementsToUseLiveId = $this->getScopeData($scope, self::KEY_TransformDependentElementsToUseLiveId);
$elementsToBeVersioned = $dependency->getElements();
......@@ -533,7 +538,7 @@ class CommandMap
*/
protected function mergeToTop(array $commandMap)
{
\TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($commandMap, $this->commandMap);
ArrayUtility::mergeRecursiveWithOverrule($commandMap, $this->commandMap);
$this->commandMap = $commandMap;
}
......@@ -544,7 +549,7 @@ class CommandMap
*/
protected function mergeToBottom(array $commandMap)
{
\TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($this->commandMap, $commandMap);
ArrayUtility::mergeRecursiveWithOverrule($this->commandMap, $commandMap);
}