/** * Gets all parent references. * * @return array */ public function getParents() { if (!isset($this->parents)) { $this->parents = array(); $rows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('*', 'sys_refindex', 'ref_table=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($this->table, 'sys_refindex') . ' AND deleted=0 AND ref_uid=' . $this->id); if (is_array($rows)) { foreach ($rows as $row) { $reference = $this->getDependency()->getFactory()->getReferencedElement($row['tablename'], $row['recuid'], $row['field'], array(), $this->getDependency()); $callbackResponse = $this->dependency->executeEventCallback(self::EVENT_CreateParentReference, $this, array('reference' => $reference)); if ($callbackResponse !== self::RESPONSE_Skip) { $this->parents[] = $reference; } } } } return $this->parents; }
/** * Applies the workspaces dependencies and removes incomplete structures or automatically * completes them, depending on the options.workspaces.considerReferences setting * * @param t3lib_utility_Dependency $dependency * @param string $scope * @return void */ protected function applyWorkspacesDependencies(t3lib_utility_Dependency $dependency, $scope) { $transformDependentElementsToUseLiveId = $this->getScopeData($scope, self::KEY_TransformDependentElementsToUseLiveId); $elementsToBeVersionized = $dependency->getElements(); if ($transformDependentElementsToUseLiveId) { $elementsToBeVersionized = $this->transformDependentElementsToUseLiveId($elementsToBeVersionized); } $outerMostParents = $dependency->getOuterMostParents(); /** @var $outerMostParent t3lib_utility_Dependency_Element */ foreach ($outerMostParents as $outerMostParent) { $dependentElements = $dependency->getNestedElements($outerMostParent); if ($transformDependentElementsToUseLiveId) { $dependentElements = $this->transformDependentElementsToUseLiveId($dependentElements); } $intersectingElements = array_intersect_key($dependentElements, $elementsToBeVersionized); if (count($intersectingElements) > 0) { // 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); // If everything is fine or references shall be considered automatically: } else { $this->update(current($intersectingElements), $dependentElements, $scope); } } } }