}
}
}
+
+ foreach ($table->getForeignKeys() as $foreignKey) {
+ $referencedTableExists = in_array($foreignKey->getReferencedTable(), $this->existingTableNames);
+ foreach ($this->tables as $processedTable) {
+ if ($processedTable->getName() === $foreignKey->getReferencedTable()) {
+ $referencedTableExists = !$processedTable->willBeDropped();
+ }
+ }
+
+ if (!$referencedTableExists) {
+ $errors[] = [
+ 'columnNames' => implode(',', $foreignKey->getColumns()),
+ 'referencedTableName' => $foreignKey->getReferencedTable(),
+ 'tableName' => $table->getName(),
+ 'type' => 'unknownTableInForeignKey',
+ ];
+ }
+ }
}
}
Der Primärindex {$error[tableName]} ({$error[columnNames]}) enthält die Spalte {$error[columnName]}, deren Werte NULL sein können.
{else if $error[type] === 'foreignForeignKeyDrop'}
Der Fremdschlüssel {$error[tableName]} ({$error[columnNames]}) gehört zu einem anderen Paket und kann deshalb nicht gelöscht werden.
+ {else if $error[type] === 'unknownTableInForeignKey'}
+ Der Fremdschlüssel {$error[tableName]} ({$error[columnNames]}) referenziert eine unbekannte Tabelle {$error[referencedTableName]}.
{else}
Unbekannter Fehler.
{/if}
The primary index {$error[tableName]} ({$error[columnNames]}) contains the column {$error[columnName]} whose values can be NULL.
{else if $error[type] === 'foreignForeignKeyDrop'}
The foreign key {$error[tableName]} ({$error[columnNames]}) belongs to a different package and thus cannot be dropped.
+ {else if $error[type] === 'unknownTableInForeignKey'}
+ The foreign key {$error[tableName]} ({$error[columnNames]}) references an unknown table {$error[referencedTableName]}.
{else}
Unknown error.
{/if}