php-ews icon indicating copy to clipboard operation
php-ews copied to clipboard

:protected array properties

Open jkirbs opened this issue 4 years ago • 2 comments

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.

jkirbs avatar Aug 02 '21 23:08 jkirbs

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 avatar Oct 26 '22 19:10 j-applese3d

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);

j-applese3d avatar Oct 27 '22 21:10 j-applese3d