Skip to content

Commit

Permalink
Merge pull request #1018 from luizcmarin/patch-1
Browse files Browse the repository at this point in the history
Update ModelCommand.php
  • Loading branch information
dereuromark authored Nov 26, 2024
2 parents ac33316 + 86e5382 commit 9869f44
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Command/ModelCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,7 @@ public function getAssociationInfo(Table $table): array
*/
public function findBelongsTo(Table $model, array $associations, ?Arguments $args = null): array
{
$className = null;
$schema = $model->getSchema();
foreach ($schema->columns() as $fieldName) {
if (!preg_match('/^.+_id$/', $fieldName) || ($schema->getPrimaryKey() === [$fieldName])) {
Expand Down Expand Up @@ -377,7 +378,6 @@ public function findBelongsTo(Table $model, array $associations, ?Arguments $arg
) {
$allowAliasRelations = $args && $args->getOption('skip-relation-check');
$found = $this->findTableReferencedBy($schema, $fieldName);
$className = null;
if ($found) {
$className = ($this->plugin ? $this->plugin . '.' : '') . Inflector::camelize($found);
} elseif (!$allowAliasRelations) {
Expand Down

0 comments on commit 9869f44

Please sign in to comment.