public function build(Connection $aConnection = null)
    {
        Type::addType('user_email', UserEmailType::class);
        Type::addType('user_id', UserIdType::class);
        Type::addType('user_password', UserPasswordType::class);
        Type::addType('user_roles', UserRolesType::class);
        Type::addType('user_token', UserTokenType::class);

        $configuration = new Configuration();
        $driver = new YamlDriver([__DIR__ . '/Mapping']);
        $configuration->setMetadataDriverImpl($driver);
        $configuration->setProxyDir(__DIR__ . '/Proxies');
        $configuration->setProxyNamespace('Proxies');
        $configuration->setHydratorDir(__DIR__ . '/Hydrators');
        $configuration->setHydratorNamespace('Hydrators');

        return DocumentManager::create($aConnection, $configuration);
    }