src/Leevel/Database/Ddd/Relation/ManyMany.php
public function matchPreLoad(array $entitys, collection $result, string $relation): array
    {
        $maps = $this->buildMap($result);

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

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

        return $entitys;
    }
public function matchPreLoad(array $entitys, collection $result, string $relation): array
    {
        $maps = $this->buildMap($result);

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

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

        return $entitys;
    }
匹配关联查询数据到模型实体.

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

@return array