Skip to content

Commit

Permalink
Avoid type error if dca does not contain any fields (#211)
Browse files Browse the repository at this point in the history
  • Loading branch information
dmolineus authored Jun 7, 2023
1 parent b1a11ad commit ad0845c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/DcaRelationsManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ public function deleteRelatedRecordsWithUndo(string $sourceTable, int|string $so
$undo = [];

foreach ($GLOBALS['TL_DCA'] as $table => $dca) {
foreach (array_keys($dca['fields']) as $fieldName) {
foreach (array_keys($dca['fields'] ?? []) as $fieldName) {
$relation = $this->getRelation($table, $fieldName);

if (null === $relation || ($relation['reference_table'] !== $sourceTable && $relation['related_table'] !== $sourceTable)) {
Expand Down

0 comments on commit ad0845c

Please sign in to comment.