Skip to content
This repository has been archived by the owner on Jul 28, 2022. It is now read-only.

Commit

Permalink
Merge c882c72 into 4b78e59
Browse files Browse the repository at this point in the history
  • Loading branch information
franmomu committed Nov 12, 2019
2 parents 4b78e59 + c882c72 commit 3122af3
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 46 deletions.
16 changes: 8 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@
"sonata-project/datagrid-bundle": "^2.3",
"sonata-project/doctrine-extensions": "^1.0",
"sonata-project/easy-extends-bundle": "^2.5",
"symfony/config": "^2.8 || ^3.2 || ^4.0",
"symfony/console": "^2.8 || ^3.2 || ^4.0",
"symfony/dependency-injection": "^2.8 || ^3.2 || ^4.0",
"symfony/event-dispatcher": "^2.8 || ^3.2 || ^4.0",
"symfony/form": "^2.8 || ^3.2 || ^4.0",
"symfony/http-foundation": "^2.8 || ^3.2 || ^4.0",
"symfony/http-kernel": "^2.8 || ^3.2 || ^4.0",
"symfony/security-core": "^2.8 || ^3.2 || ^4.0",
"symfony/config": "^3.4 || ^4.2",
"symfony/console": "^3.4 || ^4.2",
"symfony/dependency-injection": "^3.4 || ^4.2",
"symfony/event-dispatcher": "^3.4 || ^4.2",
"symfony/form": "^3.4 || ^4.2",
"symfony/http-foundation": "^3.4 || ^4.2",
"symfony/http-kernel": "^3.4 || ^4.2",
"symfony/security-core": "^3.4 || ^4.2",
"zendframework/zenddiagnostics": "^1.0"
},
"conflict": {
Expand Down
30 changes: 8 additions & 22 deletions src/DependencyInjection/Compiler/NotificationCompilerPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,28 +55,14 @@ public function process(ContainerBuilder $container)

$informations[$event['type']][] = $id;

/*
* NEXT_MAJOR: Remove check for ServiceClosureArgument and the addListenerService method call.
*/
if (class_exists(ServiceClosureArgument::class)) {
$definition->addMethodCall(
'addListener',
[
$event['type'],
[new ServiceClosureArgument(new Reference($id)), 'process'],
$priority,
]
);
} else {
$definition->addMethodCall(
'addListenerService',
[
$event['type'],
[$id, 'process'],
$priority,
]
);
}
$definition->addMethodCall(
'addListener',
[
$event['type'],
[new ServiceClosureArgument(new Reference($id)), 'process'],
$priority,
]
);
}
}

Expand Down
21 changes: 5 additions & 16 deletions src/DependencyInjection/SonataNotificationExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
use Sonata\NotificationBundle\Backend\MessageManagerBackend;
use Sonata\NotificationBundle\Model\MessageInterface;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Loader;
Expand All @@ -44,14 +43,7 @@ public function load(array $configs, ContainerBuilder $container)

$this->checkConfiguration($config);

/*
* NEXT_MAJOR: Remove the check for ServiceClosureArgument as well as core_legacy.xml.
*/
if (class_exists(ServiceClosureArgument::class)) {
$loader->load('core.xml');
} else {
$loader->load('core_legacy.xml');
}
$loader->load('core.xml');

$loader->load('backend.xml');
$loader->load('consumer.xml');
Expand Down Expand Up @@ -83,9 +75,7 @@ public function load(array $configs, ContainerBuilder $container)
$loader->load('checkmonitor.xml');
}

$container->setAlias('sonata.notification.backend', $config['backend']);
// NEXT_MAJOR: remove this getter when requiring sf3.4+
$container->getAlias('sonata.notification.backend')->setPublic(true);
$container->setAlias('sonata.notification.backend', $config['backend'])->setPublic(true);
$container->setParameter('sonata.notification.backend', $config['backend']);

$this->registerDoctrineMapping($config);
Expand Down Expand Up @@ -149,12 +139,11 @@ public function configureBackends(ContainerBuilder $container, $config)
$pause = $config['backends']['doctrine']['pause'];
$maxAge = $config['backends']['doctrine']['max_age'];
$batchSize = $config['backends']['doctrine']['batch_size'];
$container->setAlias('sonata.notification.manager.message', $config['backends']['doctrine']['message_manager']);
$container
->setAlias('sonata.notification.manager.message', $config['backends']['doctrine']['message_manager'])
->setPublic(true);

$this->configureDoctrineBackends($container, $config, $checkLevel, $pause, $maxAge, $batchSize);

// NEXT_MAJOR: remove this getter when requiring sf3.4+
$container->getAlias('sonata.notification.manager.message')->setPublic(true);
} else {
$container->removeDefinition('sonata.notification.backend.doctrine');
}
Expand Down

0 comments on commit 3122af3

Please sign in to comment.