Bug #66572 » patch.diff

Klaus Moser, 2015-04-24 14:46

View differences:

typo3/sysext/version/Classes/Dependency/DependencyEntityFactory.php 2015-04-16 09:32:44.000000000 +0200 → typo3/sysext/version/Classes/Dependency/DependencyEntityFactory.php 2015-04-24 13:05:41.997675074 +0200
30 30
	protected $references = array();
31 31

  
32 32
	/**
33
	 * @var array
34
	 */
35
	protected $tables = array();
36

  
37
	/**
33 38
	 * Gets and registers a new element.
34 39
	 *
35 40
	 * @param string $table
......
76 81
	 * @see getReference
77 82
	 */
78 83
	public function getReferencedElement($table, $id, $field, array $data = array(), \TYPO3\CMS\Version\Dependency\DependencyResolver $dependency) {
79
		return $this->getReference($this->getElement($table, $id, $data, $dependency), $field);
84

  
85
		if (empty($this->tables)) {
86
			$tables = $GLOBALS['TYPO3_DB']->admin_get_tables();
87
			$this->tables = array_keys($tables);
88
		}
89

  
90
		if (in_array($table, $this->tables) && $this->isVersionable($table)) {
91
			return $this->getReference($this->getElement($table, $id, $data, $dependency), $field);
92
		} else {
93
			return NULL;
94
		}
80 95
	}
81 96

  
97
	/**
98
	 * Check if versioning is enabled .
99
	 *
100
	 * @return boolean
101
	 */
102
	protected function isVersionable($table) {
103
		return ($GLOBALS['TCA'][$table]['ctrl']['versioningWS'] === '1');
104
	}
82 105
}
typo3/sysext/version/Classes/Dependency/ElementEntity.php 2015-04-16 09:32:44.000000000 +0200 → typo3/sysext/version/Classes/Dependency/ElementEntity.php 2015-04-23 17:58:43.541046599 +0200
216 216
					$arguments = array('table' => $row['ref_table'], 'id' => $row['ref_uid'], 'field' => $row['field'], 'scope' => self::REFERENCES_ChildOf);
217 217
					$callbackResponse = $this->dependency->executeEventCallback(self::EVENT_CreateChildReference, $this, $arguments);
218 218
					if ($callbackResponse !== self::RESPONSE_Skip) {
219
						$this->children[] = $this->getDependency()->getFactory()->getReferencedElement(
219
						$child = $this->getDependency()->getFactory()->getReferencedElement(
220 220
							$row['ref_table'],
221 221
							$row['ref_uid'],
222 222
							$row['field'],
223 223
							array(),
224 224
							$this->getDependency()
225 225
						);
226
						if (!empty($child))
227
							$this->children[] = $child;
226 228
					}
227 229
				}
228 230
			}
(1-1/2)