fix: DashboardEvent::addWidget takes string ID, not widget object

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Christopher Mühl 2026-04-08 12:53:52 +02:00
parent 263ab8a9d9
commit 1b88878210
No known key found for this signature in database
GPG key ID: 925AC7D69955293F

View file

@ -3,14 +3,10 @@
namespace KimaiPlugin\KimaiHeatmapBundle\EventSubscriber; namespace KimaiPlugin\KimaiHeatmapBundle\EventSubscriber;
use App\Event\DashboardEvent; use App\Event\DashboardEvent;
use App\Widget\WidgetService;
use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\EventDispatcher\EventSubscriberInterface;
final class DashboardSubscriber implements EventSubscriberInterface final class DashboardSubscriber implements EventSubscriberInterface
{ {
public function __construct(private readonly WidgetService $widgetService)
{
}
public static function getSubscribedEvents(): array public static function getSubscribedEvents(): array
{ {
@ -21,9 +17,6 @@ final class DashboardSubscriber implements EventSubscriberInterface
public function onDashboard(DashboardEvent $event): void public function onDashboard(DashboardEvent $event): void
{ {
$widget = $this->widgetService->getWidget('HeatmapWidget'); $event->addWidget('HeatmapWidget');
if ($widget !== null) {
$event->addWidget($widget);
}
} }
} }