diff --git a/src/ORM/EagerLoader.php b/src/ORM/EagerLoader.php index 2add34c0b5d..b1231d90751 100644 --- a/src/ORM/EagerLoader.php +++ b/src/ORM/EagerLoader.php @@ -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); } diff --git a/tests/TestCase/ORM/Association/BelongsToTest.php b/tests/TestCase/ORM/Association/BelongsToTest.php index 07d0bca4a4d..cf862d2eb42 100644 --- a/tests/TestCase/ORM/Association/BelongsToTest.php +++ b/tests/TestCase/ORM/Association/BelongsToTest.php @@ -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(); } } diff --git a/tests/TestCase/ORM/Association/HasManyTest.php b/tests/TestCase/ORM/Association/HasManyTest.php index 21566189ea7..fb3e9723184 100644 --- a/tests/TestCase/ORM/Association/HasManyTest.php +++ b/tests/TestCase/ORM/Association/HasManyTest.php @@ -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])