Skip to content

Conversation

frankdekker
Copy link
Contributor

@frankdekker frankdekker commented Jul 24, 2025

As doctrine is now a composer suggestion instead of requirement, added class_exists check when configuring doctrine in the bundle. If it's absent, do not configure the DoctrineOrmMappingsPass

@frankdekker frankdekker changed the title Test for availability of doctrine in bundle configuration fix: Test for availability of doctrine in bundle configuration Jul 24, 2025
@maitre-hibou
Copy link

Hi ! Had the issue when installing the bundle today. (issue here #248)

I would also suggest (if doctrine is not required) to not set the default persistence engine to doctrine and instead use 'in_memory' to avoid issue with this :

// vendor/league/oauth2-server-bundle/src/DependencyInjection/LeagueOAuth2ServerExtension.php

private function assertRequiredBundlesAreEnabled(ContainerBuilder $container): void
{
    $requiredBundles = [
        'security' => SecurityBundle::class,
    ];

    if ($container->hasParameter('league.oauth2_server.persistence.doctrine.enabled')) {
        $requiredBundles['doctrine'] = DoctrineBundle::class;
    }

    foreach ($requiredBundles as $bundleAlias => $requiredBundle) {
        if (!$container->hasExtension($bundleAlias)) {
            throw new \LogicException(\sprintf('Bundle \'%s\' needs to be enabled in your application kernel.', $requiredBundle));
        }
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants