title: Symfony 4.4 security get user with relation entity data after login
body: <p>I'm using the security bundle for Symfony 4.4.</p>
  <p>My &quot;User&quot; entity is related to the &quot;Info&quot; entity on OneToOne.</p>
  <p>When I'm logged I want to have &quot;Info&quot; data without extra query.</p>
  <p>for exemple in my controller (after login)</p>
  <p>when I use <code>$this-&gt;getUser();</code></p>
  <p>I have</p>
  <pre class="lang-php prettyprint-override"><code>App\Entity\User\User {#1705 ▼
    -id: 1
    -email: &quot;email@email.com&quot;
    -roles: array:1 [▶]
    -password: &quot;password&quot;
    -info: Proxies\__CG__\App\Entity\User\Info {#1716 ▼
      +__isInitialized__: false
      -id: 1
      -firstname: null
      -lastname: null
    }
  }
  </code></pre>
  <p>Expected result</p>
  <pre class="lang-php prettyprint-override"><code>App\Entity\User\User {#1705 ▼
    -id: 1
    -email: &quot;email@email.com&quot;
    -roles: array:1 [▶]
    -password: &quot;password&quot;
    -info: Proxies\__CG__\App\Entity\User\Info {#1716 ▼
      +__isInitialized__: true
      -id: 1
      -firstname: &quot;Firstname&quot;
      -lastname: &quot;Lastname&quot;
    }
  }
  </code></pre>
  <p>In my guard</p>
  <p>in <code>getUser</code> method of my guard I'm using <code>UserRepository</code> for find my user by email.</p>
  <pre class="lang-php prettyprint-override"><code>// \App\Security\AppCustomAuthenticator
  
  
      public function getUser($credentials, UserProviderInterface $userProvider)
      {
          // Load / create our user however you need.
          // You can do this by calling the user provider, or with custom logic here.
          $user = $this-&gt;userRepository-&gt;findUserByEmail($credentials['email']);
  
          if (!$user) {
              // fail authentication with a custom error
              throw new CustomUserMessageAuthenticationException('User not found');
          }
  
          return $user;
      }
  </code></pre>
  <pre class="lang-php prettyprint-override"><code>// \App\Repository\User\UserRepository
  
      public function findUserByEmail(string $email): ?User
      {
          return $this-&gt;createQueryBuilder('user')
                      -&gt;addSelect('user_info')
                      -&gt;leftJoin('user.info', 'user_info')
                      -&gt;andWhere('user.email = :email')
                      -&gt;setParameter('email', $email)
                      -&gt;getQuery()
                      -&gt;getOneOrNullResult()
              ;
      }
  </code></pre>
  <p>but I'm loosing the entity <code>Info</code> data after my login.</p>
  <p>How to keep my relation entity data after login ?</p>