Skip to content

Commit 91587f0

Browse files
committed
Add docs
1 parent 5b8fd2a commit 91587f0

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/lib/AttributeResolver.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -443,8 +443,13 @@ protected function prepareIndexes(array $indexes):array
443443
}
444444
}
445445
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
446449
if (!isset($this->attributes[$prop])) {
450+
// then check x-fk-column-name
447451
if (!in_array($prop, array_keys($xFkColumnNames))) {
452+
// then check relations/reference e.g. `user`/`user_id`
448453
$refPropName = (substr($prop, -3) === '_id') ? rtrim($prop, '_id') : null;
449454
if ($refPropName && !isset($this->attributes[$refPropName])) {
450455
throw new InvalidDefinitionException('Invalid index definition - property ' . $prop

0 commit comments

Comments
 (0)