src/Leevel/Database/Ddd/Entity.php
public function hasMany(string $relatedEntityClass, string $targetKey, string $sourceKey): HasMany
    {
        $entity = new $relatedEntityClass();

        $this->validateRelationField($entity, $targetKey);
        $this->validateRelationField($this, $sourceKey);

        return new HasMany($entity, $this, $targetKey, $sourceKey);
    }
public function hasMany(string $relatedEntityClass, string $targetKey, string $sourceKey): HasMany
    {
        $entity = new $relatedEntityClass();

        $this->validateRelationField($entity, $targetKey);
        $this->validateRelationField($this, $sourceKey);

        return new HasMany($entity, $this, $targetKey, $sourceKey);
    }
一对多关联.

@param string $relatedEntityClass
@param string $targetKey
@param string $sourceKey

@return \Leevel\Database\Ddd\Relation\HasMany