@@ -342,11 +342,6 @@ clients. There are two main ways to receive the updates:
342
342
Forms
343
343
^^^^^
344
344
345
- .. versionadded :: 2.1
346
-
347
- Prior to 2.1, ``TurboStreamResponse::STREAM_FORMAT `` was used instead of ``TurboBundle::STREAM_FORMAT ``.
348
- Also, one had to return a new ``TurboStreamResponse() `` object as the third argument to ``$this->render() ``.
349
-
350
345
Let's discover how to use Turbo Streams to enhance your `Symfony forms `_::
351
346
352
347
// src/Controller/TaskController.php
@@ -383,7 +378,6 @@ Let's discover how to use Turbo Streams to enhance your `Symfony forms`_::
383
378
return $this->redirectToRoute('task_success', [], Response::HTTP_SEE_OTHER);
384
379
}
385
380
386
- // Symfony 6.2+
387
381
return $this->render('task/new.html.twig', [
388
382
'form' => $form,
389
383
]);
@@ -500,7 +494,7 @@ Then, enable the "mercure stream" controller in ``assets/controllers.json``:
500
494
"mercure-turbo-stream": {
501
495
+ "enabled": true,
502
496
- "enabled": false,
503
- "fetch": "lazy "
497
+ "fetch": "eager "
504
498
}
505
499
},
506
500
@@ -512,14 +506,19 @@ If you use Symfony Flex, the configuration has been generated for you,
512
506
be sure to update the ``MERCURE_URL `` in the ``.env `` file to point to a
513
507
Mercure Hub (it's not necessary if you are using Symfony Docker).
514
508
515
- Otherwise, configure Mercure Hub(s) to use :
509
+ Otherwise, configure Mercure Hub(s) as explained in the documentation :
516
510
517
511
.. code-block :: yaml
518
512
519
- # config/packages/turbo.yaml
520
- turbo :
521
- mercure :
522
- hubs : [default]
513
+ # config/packages/mercure.yaml
514
+ mercure :
515
+ hubs :
516
+ default :
517
+ url : ' %env(MERCURE_URL)%'
518
+ public_url : ' %env(MERCURE_PUBLIC_URL)%'
519
+ jwt :
520
+ secret : ' %env(MERCURE_JWT_SECRET)%'
521
+ publish : ' *'
523
522
524
523
Let's create our chat::
525
524
@@ -785,13 +784,6 @@ the following configuration:
785
784
url : https://hub2.example.net/.well-known/mercure
786
785
jwt : snip
787
786
788
- .. code-block :: yaml
789
-
790
- # config/packages/turbo.yaml
791
- turbo :
792
- mercure :
793
- hubs : [hub1, hub2]
794
-
795
787
Use the appropriate Mercure ``HubInterface `` service to send a change
796
788
using a specific transport::
797
789
0 commit comments