Skip to content

Commit 5f5abb0

Browse files
committed
docs
1 parent 9795930 commit 5f5abb0

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

src/Turbo/CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
## 2.2
44

5-
- The topics defined in the Broadcast attribute now support expression language when prefixed with `@=`.
5+
- The topics defined in the `Broadcast` attribute now support expression language when prefixed with `@=`.
6+
- The `Broadcast` attribute can now be repeated, this is convenient to render several Turbo Streams Twig templates for the same change
67

78
## 2.1
89

src/Turbo/Resources/doc/index.rst

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -620,6 +620,11 @@ The ``Broadcast`` attribute comes with a set of handy options:
620620
is derived from the FQCN of the entity and from its id
621621
- ``template`` (``string``): Twig template to render (see above)
622622

623+
The ``Broadcast`` attribute can be repeated. This is convenient to
624+
to render several templates associated with their own topics for the
625+
same change (e.g. the same data is rendered in different way in the
626+
list and in the detail pages).
627+
623628
Options are transport-specific. When using Mercure, some extra options
624629
are supported:
625630

@@ -638,7 +643,8 @@ Example::
638643

639644
use Symfony\UX\Turbo\Attribute\Broadcast;
640645

641-
#[Broadcast(topics: ['@="books_by_author_" ~ entity.author?.id', 'books'], template: 'foo.stream.html.twig', private: true)]
646+
#[Broadcast(topics: ['@="book_detail" ~ entity.id', 'books'], template: 'book_detail.stream.html.twig', private: true)]
647+
#[Broadcast(topics: ['@="book_list" ~ entity.id', 'books'], template: 'book_list.stream.html.twig', private: true)]
642648
class Book
643649
{
644650
// ...

src/Turbo/Tests/app/Entity/Song.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class Song
4040
public $title = '';
4141

4242
/**
43-
* @ORM\ManyToOne(targetEntity="App\Entity\Artist", inversedBy="songs")
43+
* @ORM\ManyToOne(targetEntity=Artist::class, inversedBy="songs")
4444
*
4545
* @var Artist|null
4646
*/

0 commit comments

Comments
 (0)