src/Leevel/Database/Ddd/Relation/Relation.php
protected function getEntityKey(array $entitys, ?string $key = null): array
    {
        return array_unique(
            array_values(
                array_map(function ($entity) use ($key) {
                    return $key ?
                        $entity->__get($key) :
                        $entity->singleId();
                }, $entitys)
            )
        );
    }
protected function getEntityKey(array $entitys, ?string $key = null): array
    {
        return array_unique(
            array_values(
                array_map(function ($entity) use ($key) {
                    return $key ?
                        $entity->__get($key) :
                        $entity->singleId();
                }, $entitys)
            )
        );
    }
返回模型实体的主键.

@param \Leevel\Database\Ddd\IEntity[] $entitys
@param string                         $key

@return array