0
使用Symfony,我想使用Cache Manager(FilesystemCache)來保存我的實體。我這樣做:Symfony在緩存中保存部分信息
$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
}
二轉儲:
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
}
爲什麼我的第二個轉儲()沒有所有的信息?