title: Doctrine2 QB – how to select entities where OnetoOne entity doesn't exists
body: <p>I have two entities:</p>
  
  <pre><code>class User extends BaseEntity {
  
      /**
       * @ORM\OneToOne(targetEntity="Profile", mappedBy="user", cascade={"persist", "remove"})
       * @var Profile
       */
      protected $profile;
  }
  
  class Profile extends BaseEntity {
  
      /**
       * @ORM\OneToOne(targetEntity="User", inversedBy="profile", cascade={"persist"})
       * @ORM\JoinColumn(name="user_id", referencedColumnName="id", onDelete="CASCADE")
       * @var User
       */
      protected $user;
  }
  </code></pre>
  
  <p>What I'm trying to do is to SELECT only <code>users</code> who don't have any profile (so there's no <code>profile</code> row with <code>user_id=:user_id</code> in <code>profiles</code> table). However, I have no idea how to make my QueryBuilder.</p>
  
  <p>First, I tried something simple like </p>
  
  <pre><code>//u as user
  $query = $this-&gt;er-&gt;createQueryBuilder('u');
  $query
      -&gt;join('u.profile', 'p')
      -&gt;where('u.profile = 1');
  </code></pre>
  
  <p>But that returns <code>A single-valued association path expression to an inverse side is not supported in DQL queries. Use an explicit join instead.</code> so I suppose there's something wrong with my relationship? I tried to switch <code>join()</code> for <code>leftJoin()</code> but it didn't help either...</p>
  
  <p>So what's up with this error and how to make proper condition with <code>where()</code> to tell Doctrine I want only users where there's no profile?</p>