Symfonyでは、私のエンティティを保存するのにCache Manager(FilesystemCache)を使用します。私の第二ダンプ()は、すべての情報を持っていないのはなぜSymfonyはキャッシュに部分情報を保存します
User {#188 ▼
-id: 1
-username: "[email protected]"
-email: null
-plainPassword: null
-password: "$2y$13$sFSRu2lyDmrfFZP24vkeQOiaYJ5E2eo/kLlaIITgwTrwZunEBcO1q"
-onlineAt: null
-changePasswordAt: null
-roles: []
-registerToken: null
-versions: null
-deletedAt: null
-deletedBy: null
}
:
$find = $this->entityManager->getRepository(User::class)
->getSingleResult([
'whereId' => $id,
]);
dump($find); // First dump()
$this->cacheManager->set('user-1', $find);
dump($this->cacheManager->get('user-1')); // Second dump()
まずダンプ:
User {#457 ▼
-id: 1
-username: "[email protected]"
-email: "[email protected]"
-plainPassword: null
-password: "$2y$13$sFSRu2lyDmrfFZP24vkeQOiaYJ5E2eo/kLlaIITgwTrwZunEBcO1q"
-onlineAt: DateTime {#432 ▶}
-changePasswordAt: null
-roles: array:3 [▶]
-registerToken: null
-versions: PersistentCollection {#558 ▶}
-deletedAt: null
-deletedBy: null
}
第二にダンプ私はこれをしませんでしたか?