Skip to content

Commit

Permalink
Fix review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
ajibarra committed Jul 15, 2022
1 parent 218c3df commit 9b923fe
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/Command/ModelCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -346,12 +346,11 @@ public function findBelongsTo(Table $model, array $associations): array
];
} else {
$tmpModelName = $this->_modelNameFromKey($fieldName);
$this->getTableLocator()->get($tmpModelName);
$genericInstances = $this->getTableLocator()->genericInstances();
$associationTable = $this->getTableLocator()->get($tmpModelName);
$tables = $this->listAll();
/** Check if association model could not be instantiated as a subclass but a generic Table instance instead. */
// Check if association model could not be instantiated as a subclass but a generic Table instance instead
if (
isset($genericInstances[$tmpModelName]) &&
get_class($associationTable) === Table::class &&
!in_array(Inflector::tableize($tmpModelName), $tables, true)
) {
$found = $this->findTableReferencedBy($schema, $fieldName);
Expand Down

0 comments on commit 9b923fe

Please sign in to comment.