Skip to content

Commit

Permalink
Fixed a couple of bad references to the uid field on a Solspace Cal…
Browse files Browse the repository at this point in the history
…endar model

Fixes #73
  • Loading branch information
joshangell committed Dec 4, 2019
1 parent 12d921a commit 94434e8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
9 changes: 6 additions & 3 deletions src/services/Loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}
Expand Down Expand Up @@ -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;
}
}
}
Expand Down

0 comments on commit 94434e8

Please sign in to comment.