Skip to content

Commit 9a40657

Browse files
fix: fix mercure configuration on Review and Book
1 parent 701898e commit 9a40657

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

api/src/Entity/Book.php

+6
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,12 @@
9090
normalizationContext: [
9191
AbstractNormalizer::GROUPS => ['Book:read', 'Enum:read'],
9292
AbstractObjectNormalizer::SKIP_NULL_VALUES => true,
93+
],
94+
mercure: [
95+
'topics' => [
96+
'@=iri(object, ' . UrlGeneratorInterface::ABS_URL . ', get_operation(object, "/admin/books/{id}{._format}"))',
97+
'@=iri(object, ' . UrlGeneratorInterface::ABS_URL . ', get_operation(object, "/books/{id}{._format}"))',
98+
],
9399
]
94100
)]
95101
#[ORM\Entity(repositoryClass: BookRepository::class)]

api/src/Entity/Review.php

+7-1
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,13 @@
142142
denormalizationContext: [
143143
AbstractNormalizer::GROUPS => ['Review:write'],
144144
],
145-
collectDenormalizationErrors: true
145+
collectDenormalizationErrors: true,
146+
mercure: [
147+
'topics' => [
148+
'@=iri(object, ' . UrlGeneratorInterface::ABS_URL . ', get_operation(object, "/admin/reviews/{id}{._format}"))',
149+
'@=iri(object, ' . UrlGeneratorInterface::ABS_URL . ', get_operation(object, "/books/{bookId}/reviews/{id}{._format}"))',
150+
],
151+
]
146152
)]
147153
#[ORM\Entity(repositoryClass: ReviewRepository::class)]
148154
#[ORM\UniqueConstraint(fields: ['user', 'book'])]

0 commit comments

Comments
 (0)