From 94434e8f8653c551f7554a770d3c6c045ad5dc75 Mon Sep 17 00:00:00 2001 From: Josh Angell Date: Wed, 4 Dec 2019 10:25:41 +0000 Subject: [PATCH] Fixed a couple of bad references to the `uid` field on a Solspace Calendar model Fixes #73 --- CHANGELOG.md | 2 ++ src/services/Loader.php | 9 ++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6c9ca8a..42bd96c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p ### Changed - Bumped the PHP requirement to >= 7.1 ([#72](https://github.com/angell-co/Spoon/issues/72)) +### Fixed +- Fixed a couple of bad references to the `uid` field on a Solspace Calendar model ([#73](https://github.com/angell-co/Spoon/issues/73)) ## 3.4.0 - 2019-11-22 diff --git a/src/services/Loader.php b/src/services/Loader.php index 51e7db1..41baa06 100644 --- a/src/services/Loader.php +++ b/src/services/Loader.php @@ -113,7 +113,8 @@ public function run(): void if ($calendarService) { $calendar = $calendarService->getCalendarByHandle(end($segments)); if ($calendar) { - $this->configurator('#fieldlayoutform', 'calendar:'.$calendar->uid); + $uid = Db::uidById(\Solspace\Calendar\Records\CalendarRecord::TABLE, $calendar->id); + $this->configurator('#fieldlayoutform', 'calendar:'.$uid); } } } @@ -212,14 +213,16 @@ public function run(): void $calendarService = new \Solspace\Calendar\Services\CalendarsService(); $calendar = $calendarService->getCalendarByHandle($segments[3]); if ($calendar) { - $context = 'calendar:'.$calendar->uid; + $uid = Db::uidById(\Solspace\Calendar\Records\CalendarRecord::TABLE, $calendar->id); + $context = 'calendar:'.$uid; } } else { $calendarEventsService = new \Solspace\Calendar\Services\EventsService(); if ($calendarEventsService) { $event = $calendarEventsService->getEventById($segments[2]); if ($event) { - $context = 'calendar:'.$event->getCalendar()->uid; + $uid = Db::uidById(\Solspace\Calendar\Records\CalendarRecord::TABLE, $event->getCalendar()->id); + $context = 'calendar:'.$uid; } } }