baileyJchoi
baileyJchoi

Reputation: 473

Get object value of Microsoft Graph

I have an object $obj like this (this is the print_r version of it):

Microsoft\Graph\Model\RecurrencePatternType Object
(
    [_value:Microsoft\Graph\Core\Enum:private] => weekly
)

I want to get the value "weekly".

This is what I tried:

$obj->{0};
$obj->getValue();
$obj->value();
$obj[0];

None of those worked. How can I get it?

Upvotes: 0

Views: 467

Answers (1)

Vadim Gremyachev
Vadim Gremyachev

Reputation: 59358

As was correctly mentioned in comment since RecurrencePatternType is represented an enum type its value could be accessed via value() method.

Example

$event = $client->createRequest("GET", "/users/$userId/events/$eventId/")
    ->setReturnType(Event::class)
    ->execute();

$recurrence = $event->getRecurrence();
$patternTypeValue = $recurrence->getPattern()->getType()->value();

Upvotes: 2

Related Questions