diff --git a/src/ORM/Marshaller.php b/src/ORM/Marshaller.php index f1de596faa8..75fc36d0a51 100644 --- a/src/ORM/Marshaller.php +++ b/src/ORM/Marshaller.php @@ -380,9 +380,7 @@ protected function _loadAssociatedByIds($assoc, $ids) $target = $assoc->target(); $primaryKey = (array)$target->primaryKey(); $multi = count($primaryKey) > 1; - $primaryKey = array_map(function ($key) use ($target) { - return $target->alias() . '.' . $key; - }, $primaryKey); + $primaryKey = array_map([$target, 'aliasField'], $primaryKey); if ($multi) { if (count(current($ids)) !== count($primaryKey)) {