title: Return ORM object and convert SQL to Doctrine QueryBuilder syntax
body: <p>I'm creating a function that should return an array of User ORM object. The function should run a query to the DB and return the users where the users' contact persons has 1 company (not more or less). The relationship is like this: every user has one or more contact person and every contact person has one or more companies.</p>
  <p>The SQL to locate these users are like this. We are using PHP 7.1, Symfony 3.4 and Doctrine 2.7.</p>
  <p>The problem that I have is that I cannot manage to describe this in Doctrine QueryBuilder syntax so that an array of User ORM objects are returned. Can anybody give me some advice?</p>
  <pre><code>SELECT users.email
  FROM company
           INNER JOIN contact_person ON contact_person.id = company.belongs_to_contact_person_id
           INNER JOIN users ON users.id = contact_person.belongs_to_user_id
  GROUP BY users.email
  HAVING COUNT(company.id) = 1
  </code></pre>