Skip to content

Commit 723a7a0

Browse files
nxpthxirnnr
authored andcommitted
[BUGFIX] Indexing relations fatals if TCA is not existing
If there is a configuration with SOLR_RELATION conten object and the configured field does not exist in TCA the indexing process dies with a fatal error. The scheduler tasks stays in state "running" without further notices (f.e. index queue item marked as failed). The only place to identify the issue is the php error log. This change adds a graceful behaviour by adding a guard clause. If the relation to be resolved has no TCA, the field will be indexed empty. Resolves: #64789 Releases: master, 3.0 Change-Id: I2b5ab92c3546fcb4faf434dcd02ca618aa5ad136
1 parent b2e7fb0 commit 723a7a0

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

Classes/ContentObject/Relation.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -120,12 +120,14 @@ protected function getRelatedItems(tslib_cObj $parentContentObject) {
120120
$localTableTca = $GLOBALS['TCA'][$localTableName];
121121

122122
$localFieldName = $this->configuration['localField'];
123-
$localFieldTca = $localTableTca['columns'][$localFieldName];
124123

125-
if (isset($localFieldTca['config']['MM']) && trim($localFieldTca['config']['MM']) !== '') {
126-
$relatedItems = $this->getRelatedItemsFromMMTable($localTableName, $localRecordUid, $localFieldTca);
127-
} else {
128-
$relatedItems = $this->getRelatedItemsFromForeignTable($localFieldName, $localRecordUid, $localFieldTca, $parentContentObject);
124+
if (isset($localTableTca['columns'][$localFieldName])) {
125+
$localFieldTca = $localTableTca['columns'][$localFieldName];
126+
if (isset($localFieldTca['config']['MM']) && trim($localFieldTca['config']['MM']) !== '') {
127+
$relatedItems = $this->getRelatedItemsFromMMTable($localTableName, $localRecordUid, $localFieldTca);
128+
} else {
129+
$relatedItems = $this->getRelatedItemsFromForeignTable($localFieldName, $localRecordUid, $localFieldTca, $parentContentObject);
130+
}
129131
}
130132

131133
return $relatedItems;
@@ -145,6 +147,7 @@ protected function getRelatedItemsFromForeignTable($localFieldName, $localRecord
145147

146148
$foreignTableName = $localFieldTca['config']['foreign_table'];
147149
t3lib_div::loadTCA($foreignTableName);
150+
148151
$foreignTableTca = $GLOBALS['TCA'][$foreignTableName];
149152

150153
$foreignTableLabelField = $this->resolveForeignTableLabelField($foreignTableTca);

0 commit comments

Comments
 (0)