title: "Couldn't find class" Doctrine Subqueries
body: <p>I'm using Symfony 1.4 with Doctrine. I have a doctrine class called Image and a method that (should) find the next and previous values via a query. The offending code looks like this:</p>
  
  <pre><code>$q = Doctrine_Core::getTable('Image')-&gt;createQuery()
              -&gt;from('Image i')
              -&gt;where('i.id = (select max(a.id) from Image a where ? &gt; a.id and is_active = 1)', $this-&gt;getId())
              -&gt;orWhere('i.id = (select min(b.id) from Image b where ? &lt; b.id and is_active = 1)', $this-&gt;getId());
  </code></pre>
  
  <p>I always get the </p>
  
  <blockquote>
    <p>500 | Internal Server Error | Doctrine_Exception Couldn't find class a</p>
  </blockquote>
  
  <p>error. Any hints?</p>