Skip to content

Commit f1b25a5

Browse files
authored
Merge pull request #1070 from othercorey/patch-1
Fix checking references int non-foreign constraints
2 parents c8dc9c6 + 1d570b8 commit f1b25a5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Command/ModelCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ public function findTableReferencedBy(TableSchemaInterface $schema, string $keyF
424424

425425
foreach ($schema->constraints() as $constraint) {
426426
$constraintInfo = $schema->getConstraint($constraint);
427-
if (!in_array($keyField, $constraintInfo['columns'])) {
427+
if (!in_array($keyField, $constraintInfo['columns'] ?? [])) {
428428
continue;
429429
}
430430

@@ -933,7 +933,7 @@ public function fieldValidation(
933933

934934
foreach ($schema->constraints() as $constraint) {
935935
$constraint = $schema->getConstraint($constraint);
936-
if (!in_array($fieldName, $constraint['columns'], true) || count($constraint['columns']) > 1) {
936+
if (!in_array($fieldName, $constraint['columns'] ?? [], true) || count($constraint['columns']) > 1) {
937937
continue;
938938
}
939939

0 commit comments

Comments
 (0)