Commit b201e237 authored by Mat's avatar Mat

nécessaire de rafraîchir mon élément (en websocket, il garde tout mémoire)

parent 40689c80
......@@ -144,6 +144,7 @@ class ChatHub implements MessageComponentInterface
*/
private function refreshUsers()
{
$em = $this->getDoctrine()->getManager();
$repo = $this->getDoctrine()->getRepository(User::class);
// twig va génèrer le fragment à retourner
......@@ -151,8 +152,10 @@ class ChatHub implements MessageComponentInterface
// array_map récupère chaque user et le map avec nos clients
$fragment = $twig->render('@Socket/Chat/listUsers.html.twig', array(
'users' => array_map(function ($username) use($repo) {
return $repo->findOneBy(array('username' => $username));
'users' => array_map(function ($username) use($repo, $em) {
$user = $repo->findOneBy(array('username' => $username));
$em->refresh($user);
return $user;
}, array_keys($this->clients))
));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment