mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
fix remote calendar compiler to allow to compile kernel without any configuration
This commit is contained in:
parent
c60a54eb39
commit
7859439f0b
@ -11,7 +11,9 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Chill\CalendarBundle\RemoteCalendar\DependencyInjection;
|
namespace Chill\CalendarBundle\RemoteCalendar\DependencyInjection;
|
||||||
|
|
||||||
|
use Chill\CalendarBundle\Command\AzureGrantAdminConsentAndAcquireToken;
|
||||||
use Chill\CalendarBundle\Command\MapUserCalendarCommand;
|
use Chill\CalendarBundle\Command\MapUserCalendarCommand;
|
||||||
|
use Chill\CalendarBundle\Controller\RemoteCalendarConnectAzureController;
|
||||||
use Chill\CalendarBundle\RemoteCalendar\Connector\MSGraphRemoteCalendarConnector;
|
use Chill\CalendarBundle\RemoteCalendar\Connector\MSGraphRemoteCalendarConnector;
|
||||||
use Chill\CalendarBundle\RemoteCalendar\Connector\NullRemoteCalendarConnector;
|
use Chill\CalendarBundle\RemoteCalendar\Connector\NullRemoteCalendarConnector;
|
||||||
use Chill\CalendarBundle\RemoteCalendar\Connector\RemoteCalendarConnectorInterface;
|
use Chill\CalendarBundle\RemoteCalendar\Connector\RemoteCalendarConnectorInterface;
|
||||||
@ -27,21 +29,25 @@ class RemoteCalendarCompilerPass implements CompilerPassInterface
|
|||||||
$config = $container->getParameter('chill_calendar');
|
$config = $container->getParameter('chill_calendar');
|
||||||
$connector = null;
|
$connector = null;
|
||||||
|
|
||||||
if ($config['remote_calendars_sync']['enabled']) {
|
if (!$config['remote_calendars_sync']['enabled']) {
|
||||||
$connector = NullRemoteCalendarConnector::class;
|
$connector = NullRemoteCalendarConnector::class;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($config['remote_calendars_sync']['microsoft_graph']['enabled']) {
|
if ($config['remote_calendars_sync']['microsoft_graph']['enabled']) {
|
||||||
$connector = MSGraphRemoteCalendarConnector::class;
|
$connector = MSGraphRemoteCalendarConnector::class;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// remove services which cannot be loaded
|
// remove services which cannot be loaded
|
||||||
$container->removeDefinition(MapUserCalendarCommand::class);
|
$container->removeDefinition(MapUserCalendarCommand::class);
|
||||||
|
$container->removeDefinition(AzureGrantAdminConsentAndAcquireToken::class);
|
||||||
|
$container->removeDefinition(RemoteCalendarConnectAzureController::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$container->hasAlias(Azure::class)) {
|
if (!$container->hasAlias(Azure::class) && $container->hasDefinition('knpu.oauth2.client.azure')) {
|
||||||
$container->setAlias(Azure::class, 'knpu.oauth2.provider.azure');
|
$container->setAlias(Azure::class, 'knpu.oauth2.provider.azure');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (null === $connector) {
|
if (null === $connector) {
|
||||||
throw new RuntimeException('Could not configure remote calendar');
|
throw new RuntimeException('Could not configure remote calendar');
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user