u01jmg3 / ics-parser

Parser for iCalendar Events • PHP 8+, 7 (≥ 7.4), 5 (≥ 5.6)
MIT License
439 stars 144 forks source link

Dynamic properties in private additionalProperties don't allow determining what properties might exist. #329

Closed karlshea closed 7 months ago

karlshea commented 7 months ago

PHP Version

8.1.26

PHP date.timezone

America/Chicago

ICS Parser Version

3.3.1

Operating System

Linux

Description

I'm using this package through the Drupal module feeds_ical to import events, and the way Drupal's Feeds module works requires use of a data transfer object that's initialized by looping through the ics-parser events parsed from the feed.

The problem I'm running into is that it loops through the Event properties to set their values on the data transfer object, but since $additionalProperties is private there isn't a way for it to find out what keys might be in that array so it can get their values.

It seems like the solution would be to mark that property as public, so the module could look at what's in there.

Steps to Reproduce

// Loop over information from feed and add to item.
foreach ($event as $eventProperty => $eventPropertyValue) {
  // No properties from $additionalProperties appear.
}

Drupal issue: https://www.drupal.org/project/feeds_ical/issues/3358713

u01jmg3 commented 7 months ago

Thanks for logging an issue. Feel free to submit a PR with your change.

karlshea commented 7 months ago

Thank you!