/** * Applies the workspaces dependencies and removes incomplete structures or automatically * completes them, depending on the options.workspaces.considerReferences setting * * @param \TYPO3\CMS\Version\Dependency\DependencyResolver $dependency * @param string $scope * @return void */ protected function applyWorkspacesDependencies(\TYPO3\CMS\Version\Dependency\DependencyResolver $dependency, $scope) { $transformDependentElementsToUseLiveId = $this->getScopeData($scope, self::KEY_TransformDependentElementsToUseLiveId); $elementsToBeVersioned = $dependency->getElements(); // Use the uid of the live record instead of the workspace record: if ($transformDependentElementsToUseLiveId) { $elementsToBeVersioned = $this->getElementEntityProcessor()->transformDependentElementsToUseLiveId($elementsToBeVersioned); } $outerMostParents = $dependency->getOuterMostParents(); /** @var $outerMostParent ElementEntity */ foreach ($outerMostParents as $outerMostParent) { $dependentElements = $dependency->getNestedElements($outerMostParent); if ($transformDependentElementsToUseLiveId) { $dependentElements = $this->getElementEntityProcessor()->transformDependentElementsToUseLiveId($dependentElements); } // Gets the difference (intersection) between elements that were submitted by the user // and the evaluation of all dependent records that should be used for this action instead: $intersectingElements = array_intersect_key($dependentElements, $elementsToBeVersioned); if (!empty($intersectingElements)) { // If at least one element intersects but not all, throw away all elements of the depdendent structure: if (count($intersectingElements) !== count($dependentElements) && $this->workspacesConsiderReferences === false) { $this->purgeWithErrorMessage($intersectingElements, $scope); } else { $this->update(current($intersectingElements), $dependentElements, $scope); } } } }