DoctrineNamespace.php 708 Bytes
Newer Older
1
<?php declare(strict_types=1);
2
/*
Guillaume Perréal's avatar
CS.    
Guillaume Perréal committed
3
4
 * Copyright (C) 2016-2017 IRSTEA
 * All rights reserved.
5
6
7
8
9
 */

namespace Irstea\PlantUmlBundle\Doctrine;

/**
Guillaume Perréal's avatar
CS.    
Guillaume Perréal committed
10
 * Description of DoctrineNamespace.
11
12
13
 */
class DoctrineNamespace extends \Irstea\PlantUmlBundle\Model\Namespace_\MappedNamespace
{
14
15
    public const CONF_TYPE = 'entities';
    public const SEPARATOR = '::';
16

17
    public function __construct(\Doctrine\ORM\EntityManagerInterface $em)
18
    {
19
20
        $entityNamespaces = $em->getConfiguration()->getEntityNamespaces();

21
        $mapping = [];
Guillaume Perréal's avatar
CS.    
Guillaume Perréal committed
22
23
        foreach ($entityNamespaces as $alias => $namespace) {
            $mapping[$namespace . '\\'] = $alias . '::';
24
25
26
27
        }
        parent::__construct($mapping);
    }
}