Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-Authored-By: othercorey <corey.taylor.fl@gmail.com>
  • Loading branch information
markstory and othercorey committed Dec 20, 2019
1 parent 2a10fc7 commit 9410ffa
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/ORM/EagerLoader.php
Expand Up @@ -650,14 +650,14 @@ public function loadExternal(Query $query, StatementInterface $statement): State

$requiresKeys = $instance->requiresKeys($config);
if ($requiresKeys) {
// If the path or alias has no key the required assoication load will fail.
// If the path or alias has no key the required association load will fail.
// Nested paths are not subject to this condition because they could
// be attached to joined associations.
if (
strpos($path, '.') === false &&
(!array_key_exists($path, $collected) || !array_key_exists($alias, $collected[$path]))
) {
$message = "Unable to load `{$path}` association. Ensure foreign key on `{$alias}` is selected.";
$message = "Unable to load `{$path}` association. Ensure foreign key in `{$alias}` is selected.";
throw new InvalidArgumentException($message);
}

Expand Down
2 changes: 1 addition & 1 deletion tests/TestCase/ORM/Association/BelongsToTest.php
Expand Up @@ -453,7 +453,7 @@ public function testAttachToNoForeignKeySelect()
->contain('Authors');

$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage('Unable to load `Authors` association. Ensure foreign key on `Articles`');
$this->expectExceptionMessage('Unable to load `Authors` association. Ensure foreign key in `Articles`');
$query->first();
}
}
2 changes: 1 addition & 1 deletion tests/TestCase/ORM/Association/HasManyTest.php
Expand Up @@ -465,7 +465,7 @@ public function testEagerloaderNoForeignKeys()
$authors->hasMany('Articles');

$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage('Unable to load `Articles` association. Ensure foreign key on `Authors`');
$this->expectExceptionMessage('Unable to load `Articles` association. Ensure foreign key in `Authors`');
$query = $authors->find()
->select(['Authors.name'])
->where(['Authors.id' => 1])
Expand Down

0 comments on commit 9410ffa

Please sign in to comment.