title: Can I get a user by their username and password using Doctrine (findOneBy()) on Symfony 4?
body: <p>I want to get a user by their username and password using Doctrine (<code>findOneBy()</code> method), on Symfony4.</p>
  
  <pre><code>security:
      encoders:
          App\Entity\User:
          algorithm: argon2i
  </code></pre>
  
  <pre class="lang-php prettyprint-override"><code>$username= $request-&gt;request-&gt;get('username');
  $password = $request-&gt;request-&gt;get('password');
  $user= $this-&gt;em-&gt;getRepository(User::class)-&gt;findOneBy([
      'username'=&gt;$username,
      'passsword'=&gt;$password
  ]);
  return  new Response($user);
  </code></pre>