title: Does Doctrine2 apply filters to delete statements
body: <p>I use doctrine filters and recently noticed that filters are not applied to delete statements. I have tried to dig through documentation and google, but mystery stays unsolved.</p>
  
  <p>For example I have filter which connects user to company so every select query like:</p>
  
  <pre><code>$userRepo-&gt;find(12);
  </code></pre>
  
  <p>and is modified from </p>
  
  <blockquote>
    <p>SELECT .... FROM user t0 WHERE t0.id = 12</p>
  </blockquote>
  
  <p>into </p>
  
  <blockquote>
    <p>SELECT .... FROM user t0 WHERE t0.id = 12 AND (t0.company_id = '6')</p>
  </blockquote>
  
  <p>cool, that is what I need.</p>
  
  <p>What bothers me is that delete statements seems to be untouched. Does anyone know if it is default doctrine architecture or my configuration is wrong?</p>
  
  <p>The filter</p>
  
  <pre><code>use Doctrine\ORM\Mapping\ClassMetaData;
  use Doctrine\ORM\Query\Filter\SQLFilter;
  use Doctrine\Common\Annotations\Reader;
  
  class CompanyAware extends SQLFilter
  {
      /**
       * @var Reader
       */
      protected $reader;
  
      /**
       * @param ClassMetaData $targetEntity
       * @param string $targetTableAlias
       *
       * @return string
       */
      public function addFilterConstraint(ClassMetadata $targetEntity, $targetTableAlias)
      {
          $query = '';
          $ann = 'Mrok\\PortalBundle\\Annotation\\CompanyAware';
          $isAware = $this-&gt;reader-&gt;getClassAnnotation($targetEntity-&gt;getReflectionClass(), $ann);
  
          if ($isAware) {
              $id = $this-&gt;getParameter('id');
              $query = sprintf('%s.company_id = %s', $targetTableAlias, $id);
          }
  
          return $query;
      }
  
      public function setAnnotationReader(Reader $reader)
      {
          $this-&gt;reader = $reader;
      }
  }
  </code></pre>