Garethp / php-ews

PHP Exchange Web Services
BSD 3-Clause "New" or "Revised" License
112 stars 45 forks source link

:protected array properties #220

Open jkirbs opened 3 years ago

jkirbs commented 3 years ago

i'm using the example to get calendar events examples/calendar/getCalendarItems.php but the array properties are :protected. i'm a little lost at how to loop through these. any direction would be greatly appreciated.

j-applese3d commented 1 year ago

Take a look at MagicMethodsTrait.php it's expecting you to use the magic methods to get values...

foreach ($items as $calItem) {
    echo $calItem->getDateTimeStamp() . "\n";
    echo $calItem->getLocation() . "\n";
}

I wish it wasn't, so I'm trying to find a way to get a basic \stdClass object -- not the translated Type ones...

j-applese3d commented 1 year ago

Finally stumbled upon the setting I wanted. :) If you don't want the fancy classes with protected properties, getters, setters etc, just set the classmap option to null or similar.

$ews = API::withCallbackToken('outlook.office365.com', $token, [
    'classmap' => null,
]);
$responseObject = $ews->getClient()->FindItem($request);