microsoftgraph / microsoftgraph/msgraph-sdk-php

JSON Encode models

Open
#1,452 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

v2: feedback
Dominant language
PHP
Stars
669
Forks
150
Avg merge
15h 21m
Merged PRs (30d)
3

Description

Hi,

I've been implementing the v2.2 version of the msgraph-sdk this week; however I'm facing an issue.
How can I encode the models returned from the client to JSON so it contains all values? It seems the actual values are in the BackingStore, but how can I make sure I get the actual data to be passed in a response?

For e.g. this works; but doesn't feel as the right solution:

json_encode($event->getBackingStore()->enumerate());

For reference, this is my code example below;

$requestConfig = new CalendarViewRequestBuilderGetRequestConfiguration(
    headers: [
        'Prefer' => 'outlook.timezone="W. Europe Standard Time"',
    ],
    queryParameters: CalendarViewRequestBuilderGetRequestConfiguration::createQueryParameters(
        endDateTime: $endDate,
        startDateTime: $startDate,
        top: 500
    )
);

$events = $this->graphClient
    ->users()
    ->byUserId($userId)
    ->calendar()
    ->calendarView()
    ->get($requestConfig)
    ->wait()
;

foreach ($events->getValue() as $event) {
        // I want to get the complete object as JSON values to be passed in a response
        json_encode($event->getBackingStore()->enumerate());
}

Thank you in advance

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names the PHP SDK models and their BackingStore, but no source file, entry point, or test. Start by locating the model serialization and JSON handling, then confirm the expected complete-object output and add or update coverage; the issue does not define acceptance criteria.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
api
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
15/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.