src/Metadata/AliasedMetadataFactory.php
public function createMetadata(array $alias)
    {
        $metadata = $this->manager->getMetadataForClassName($alias['class']);
        $aliasedMetadata = new Metadata($metadata->getObjectIdentifier());

        foreach ($metadata->getRelations() as $relation) {
            if (array_key_exists($relation->getField(), $alias['mapping'])) {
                $aliasedMetadata->setRelation(
                    $this->createAliasedRelation(
                        $alias['mapping'][$relation->getField()],
                        $relation
                    )
                );
            } else {
                $aliasedMetadata->setRelation($relation);
            }
        }

        return $aliasedMetadata;
    }
public function createMetadata(array $alias)
    {
        $metadata = $this->manager->getMetadataForClassName($alias['class']);
        $aliasedMetadata = new Metadata($metadata->getObjectIdentifier());

        foreach ($metadata->getRelations() as $relation) {
            if (array_key_exists($relation->getField(), $alias['mapping'])) {
                $aliasedMetadata->setRelation(
                    $this->createAliasedRelation(
                        $alias['mapping'][$relation->getField()],
                        $relation
                    )
                );
            } else {
                $aliasedMetadata->setRelation($relation);
            }
        }

        return $aliasedMetadata;
    }
@param array $alias

@return Metadata

@throws MetadataNotFoundException