title: Joining Entities on query in Doctrine 2
body: <p>I am trying to join two entities in one advanced query in Doctrine 2. I am working with Zend Framework 2.</p>
  
  <p>Unfortunately I have a hard time to find heads and tails in what I'm doing right now.</p>
  
  <p>Here is what I have got in ZF2:</p>
  
  <ul>
  <li>I have build a module that is called <code>KryuuCategorizer</code>, that I am going to use for categorize all kinds of contents on the site.</li>
  <li>It is attached to a event called categorize, which will get a entity type</li>
  </ul>
  
  <p>Categorizer has 2 Entities:</p>
  
  <pre><code>Category
    var id
    var name
    var objects
  
  Object
    var id
    var entityName
    var module
    var entityId
    var category
  </code></pre>
  
  <p><code>Category-&gt;objects</code> is bound by ManyToOne to <code>Object-&gt;category</code></p>
  
  <p>Then I need to bind the entity manually to the Object->entityId, I think I should be able to do this by using join in Doctrine 2.
  But I am not sure where to start or how to get a grip on it.
  I hope somebody can get me started and show me in the right direction, I looked at the Doctrine documentation, but got more confused than I should.</p>