microsoftgraph / microsoftgraph/msgraph-sdk-php
Error in using sdk in Symfony with caching
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 669
- Forks
- 150
- Avg merge
- 15h 21m
- Merged PRs (30d)
- 3
Description
When I get a model from the graph, I get the correct model. But I'm using caching in Symfony to save requests.
return $this->cache->get($cacheKey, function (ItemInterface $item) use ($type, $email) {
$item->expiresAfter(self::CACHE_EXPIRES_IN_SECONDS_SHORT);
try {
$requestConfig
= new GroupsRequestBuilderGetRequestConfiguration(queryParameters: GroupsRequestBuilderGetRequestConfiguration::createQueryParameters(filter: 'startsWith(mail,\''
. $email . '\')'));
$groups = $this->graphClient->groups()->get($requestConfig)->wait()->getValue();
if ($groups) {
foreach ($groups as $group) {
if ($group instanceof \Microsoft\Graph\Generated\Models\Group && $group->getMail() == $email) {
return $group;
}
}
}
return null;
} catch (ApiException $exception) {
$this->handleException($exception);
}
});
In my local machine, this gives no trouble, when testing this.
On my remote machine, I get an error
In DefaultMarshaller.php line 50:
Serialization of 'Closure' is not allowed
It seems the serialization does not work well on this model?
Any suggestions?
Tim
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Symfony cache callback shown in the issue and inspect DefaultMarshaller.php line 50, then compare the local and remote environments where the error differs. Reproduce the model retrieval through caching and determine the failing serialization boundary; done means the cause is documented and the behavior is covered by a regression test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php, symfony
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100