title: Condition to check existence of joined entity in Doctrine 2.1
body: <p>I have two entities in Doctine 2.1 with OneToOne Bidirectional relationship.</p>
  
  <pre><code>Foo              |   Bar
  --------------   |   --------------
  id:    integer   |   id:    integer
  value: integer   |   value: boolean
  bar:   Bar       |   foo:   Foo
  </code></pre>
  
  <p>So that:</p>
  
  <pre><code>Foo.bar &gt; 1...0 &gt; Bar
  </code></pre>
  
  <p>I want to select all Foo records using Query Builder or DQL where</p>
  
  <ol>
  <li><p><code>Foo.value &gt; :value</code></p>
  
  <p><strong>OR</strong></p></li>
  <li><p><code>Foo.bar</code> is not empty, i.e. there is a <code>Bar</code> entity for this <code>Foo</code> entity</p></li>
  </ol>
  
  <p>How do i do this?</p>
  
  <p>I'm using code like this:</p>
  
  <pre class="lang-php prettyprint-override"><code>$builder
      -&gt;select('F')
      -&gt;from('Foo', 'F')
      -&gt;where('F.value &gt; :value')
      -&gt;orWhere('F.bar ???')
  ;
  </code></pre>
  
  <p>DQL solution will also suffice.</p>