Closed DjeeBay closed 1 year ago
@DjeeBay unfortunately this is a currently known issue with v1.x of our SDK - where an array of objects should be returned instead. Fixing this required a breaking change that is available in our current v2.x Release Candidates.
If you'd prefer to stick to v1, here's a hacky workaround:
$daysOfWeek = array_map(fn ($day) => new DayOfWeek($day), $scheduleInfo->getWorkingHours()->getProperties()['daysOfWeek']);
When getting a ScheduleInformation object I can call getWorkingHours() which works well, then getDaysOfWeek(). This method throws an error : Array to string conversion.
The error occurs in the Core/Enum.php constructor. Indeed in the WorkingHours.php, the getDaysOfWeek method tries to instantiate a DayOfWeek Enum with an array of strings