Skip to content

Commit a80a7c3

Browse files
committed
bug #659 [LiveComponent] Removal of old method_exists (weaverryan)
This PR was squashed before being merged into the 2.x branch. Discussion ---------- [LiveComponent] Removal of old method_exists | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | Tickets | None | License | MIT `method_exists()` was needed for 2.2 feature, before 2.2 twig components was released. LiveComponents now required 2.5 of TwigComponents. Also, unrelated typo in CHANGELOG. Commits ------- dd6e52b [LiveComponent] Removal of old method_exists
2 parents 72fe508 + dd6e52b commit a80a7c3

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

src/Chartjs/CHANGELOG.md

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

33
## 2.7.0
44

5-
- The `chart:connect` JavaScript event now bubbles up.
5+
- The `chartjs:connect` JavaScript event now bubbles up.
66

77
- Add `assets/src` to `.gitattributes` to exclude source TypeScript files from
88
installing.

src/LiveComponent/src/EventListener/AddLiveAttributesSubscriber.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,7 @@ public function onPreRender(PreRenderEvent $event): void
4848
return;
4949
}
5050

51-
if (method_exists($event, 'isEmbedded') && $event->isEmbedded()) {
52-
// TODO: remove method_exists once min ux-twig-component version has this method
51+
if ($event->isEmbedded()) {
5352
throw new \LogicException('Embedded components cannot be live.');
5453
}
5554

src/Turbo/src/Bridge/Mercure/Broadcaster.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,10 @@ public function broadcast(object $entity, string $action, array $options): void
9797
$options['topics'] = $topics;
9898

9999
if (0 === \count($options['topics'])) {
100+
if (!isset($options['id'])) {
101+
throw new \InvalidArgumentException(sprintf('Cannot broadcast entity of class "%s": the option "topics" is empty and "id" is missing.', $entityClass));
102+
}
103+
100104
$options['topics'] = (array) sprintf(self::TOPIC_PATTERN, rawurlencode($entityClass), rawurlencode(implode('-', (array) $options['id'])));
101105
}
102106

0 commit comments

Comments
 (0)