File tree Expand file tree Collapse file tree 1 file changed +5
-0
lines changed Expand file tree Collapse file tree 1 file changed +5
-0
lines changed Original file line number Diff line number Diff line change @@ -443,8 +443,13 @@ protected function prepareIndexes(array $indexes):array
443
443
}
444
444
}
445
445
foreach ($ props as $ prop ) {
446
+ // for more info see test tests/specs/fk_col_name/fk_col_name.yaml
447
+ // File: ForeignKeyColumnNameTest::testIndexForColumnWithCustomName
448
+ // first check direct column names
446
449
if (!isset ($ this ->attributes [$ prop ])) {
450
+ // then check x-fk-column-name
447
451
if (!in_array ($ prop , array_keys ($ xFkColumnNames ))) {
452
+ // then check relations/reference e.g. `user`/`user_id`
448
453
$ refPropName = (substr ($ prop , -3 ) === '_id ' ) ? rtrim ($ prop , '_id ' ) : null ;
449
454
if ($ refPropName && !isset ($ this ->attributes [$ refPropName ])) {
450
455
throw new InvalidDefinitionException ('Invalid index definition - property ' . $ prop
You can’t perform that action at this time.
0 commit comments