src/Leevel/Database/Ddd/Relation/HasMany.php
protected function matchPreLoadOneOrMany(array $entitys, Collection $result, string $relation, string $type): array
    {
        $maps = $this->buildMap($result);

        foreach ($entitys as &$entity) {
            $key = $entity->__get($this->sourceKey);

            if (isset($maps[$key])) {
                $entity->withRelationProp(
                    $relation,
                    $this->getRelationValue($maps, $key, $type)
                );
            }
        }

        return $entitys;
    }
protected function matchPreLoadOneOrMany(array $entitys, Collection $result, string $relation, string $type): array
    {
        $maps = $this->buildMap($result);

        foreach ($entitys as &$entity) {
            $key = $entity->__get($this->sourceKey);

            if (isset($maps[$key])) {
                $entity->withRelationProp(
                    $relation,
                    $this->getRelationValue($maps, $key, $type)
                );
            }
        }

        return $entitys;
    }
匹配预载入数据.

@param \Leevel\Database\Ddd\IEntity[] $entitys
@param \Leevel\Collection\Collection  $result
@param string                         $relation
@param string                         $type

@return array