Error in using sdk in Symfony with caching

未關閉
#1,471 2 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

評估

難度
3/5
預估耗時
1-2 天
新手友好度
25/100
Issue 類型
缺陷
描述清晰度
需要釐清
活躍度
停滯
技術堆疊
php, symfony
領域
api, backend

研究方向

從 issue 中展示的 Symfony 快取回呼開始,檢查 DefaultMarshaller.php 第 50 行,然後比較發生不同錯誤的本機環境和遠端環境。透過快取重現模型取得流程,並確定失敗的序列化邊界;當原因已記錄且該行為已由回歸測試涵蓋時,即表示完成。

由索引模型根據 Issue 內容生成。

描述

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

主要語言
PHP
星號
669
分支
149
平均合併
1 天 4 小時
30 天內合併 PR
5

環境準備

  • 沒有 Dockerfile 或 Docker Compose 檔案
  • 沒有 Pull Request 範本
  • 閱讀貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

microsoftgraph/msgraph-sdk-php 的其他 Issue

查看 microsoftgraph/msgraph-sdk-php 的全部 Issue

相似的 Issue

更多 PHP Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。