title: Doctrine addFilterConstraint on joined table
body: <p>I'm using <a href="http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/filters.html" rel="nofollow noreferrer">Doctrine Filters</a> in my Symfony 3.x application.</p>
  
  <p>Now, I need to filter a <strong>joined table</strong>, but the addFilterConstraint method <strong>allways receive the inheritance root</strong>:</p>
  
  <blockquote>
    <p>In the case of joined or single table inheritance, you always get passed the ClassMetadata of the inheritance root. This is necessary to avoid edge cases that would break the SQL when applying the filters.</p>
  </blockquote>
  
  <p>This is (part of) my class:</p>
  
  <pre><code>&lt;?php
  namespace AppBundle\Filter;
  
  use Doctrine\ORM\Mapping\ClassMetaData;
  use Doctrine\ORM\Query\Filter\SQLFilter;
  
  class DataAbstractionFilter extends SQLFilter
  {
      public function addFilterConstraint(ClassMetadata $targetEntity, $targetTableAlias)
  </code></pre>
  
  <p>For example, if I had the classes:</p>
  
  <pre><code>class SomeClass {/**/}
  
  class SomeChildClass1 extends SomeClass {/**/}
  
  class SomeChildClass2 extends SomeClass {/**/}
  </code></pre>
  
  <p>addFilterConstraints will allways receive <strong>SomeClass</strong>.</p>
  
  <p>Any suggestions? Thanks in advance.</p>