Skip to content

Commit 50ab731

Browse files
committed
[Notify][Turbo] Add support for MercureBundle ^0.4.0 and Mercure ^0.7.0
1 parent c756147 commit 50ab731

File tree

5 files changed

+15
-3
lines changed

5 files changed

+15
-3
lines changed

src/Notify/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# CHANGELOG
22

3+
## 2.32
4+
5+
- Add support for MercureBundle ^0.4.0 and Mercure ^0.7.0
6+
37
## 2.30
48

59
- Ensure compatibility with PHP 8.5

src/Notify/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
"symfony/config": "^5.4|^6.0|^7.0|^8.0",
3333
"symfony/dependency-injection": "^5.4|^6.0|^7.0|^8.0",
3434
"symfony/http-kernel": "^5.4|^6.0|^7.0|^8.0",
35-
"symfony/mercure-bundle": "^0.3.4",
35+
"symfony/mercure-bundle": "^0.3.4|^0.4.0",
3636
"symfony/mercure-notifier": "^5.4|^6.0|^7.0|^8.0",
3737
"symfony/stimulus-bundle": "^2.9.1",
3838
"symfony/twig-bundle": "^5.4|^6.0|^7.0|^8.0"

src/Turbo/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# CHANGELOG
22

3+
## 2.32
4+
5+
- Add support for MercureBundle ^0.4.0 and Mercure ^0.7.0
6+
37
## 2.30
48

59
- Ensure compatibility with PHP 8.5

src/Turbo/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
"symfony/debug-bundle": "^5.4|^6.0|^7.0|^8.0",
4646
"symfony/form": "^5.4|^6.0|^7.0|^8.0",
4747
"symfony/framework-bundle": "^6.4|^7.0|^8.0",
48-
"symfony/mercure-bundle": "^0.3.7",
48+
"symfony/mercure-bundle": "^0.3.7|^0.4.0",
4949
"symfony/messenger": "^5.4|^6.0|^7.0|^8.0",
5050
"symfony/panther": "^2.2",
5151
"symfony/phpunit-bridge": "^5.4|^6.0|^7.0|^8.0",

src/Turbo/src/Bridge/Mercure/TurboStreamListenRenderer.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
use Symfony\WebpackEncoreBundle\Twig\StimulusTwigExtension;
2020
use Twig\Environment;
2121
use Twig\Error\RuntimeError;
22+
use Twig\Extension\AbstractExtension;
2223

2324
/**
2425
* Renders the attributes to load the "mercure-turbo-stream" controller.
@@ -64,7 +65,10 @@ public function renderTurboStreamListen(Environment $env, $topic /* array $event
6465

6566
if (isset($eventSourceOptions)) {
6667
try {
67-
$mercure = $this->twig->getExtension(MercureExtension::class);
68+
// Mercure >= 0.7: https://github.com/symfony/mercure/pull/123
69+
$mercure = MercureExtension::class instanceof AbstractExtension
70+
? $this->twig->getExtension(MercureExtension::class)
71+
: $this->twig->getRuntime(MercureExtension::class);
6872

6973
if ($eventSourceOptions['withCredentials'] ?? false) {
7074
$eventSourceOptions['subscribe'] ??= $topics;

0 commit comments

Comments
 (0)