title: Select entities assuming related entity does not exist
body: <p>My entity (Product) has a unidirectional many-many relation with another entity (Company) called <strong>deletedByCompanies</strong>.</p>
  
  <p>I wish to select all Products that has not been deleted by a particular company. That is all products that are not connected through that many-many relation.</p>
  
  <p>Tried:</p>
  
  <pre><code>$this-&gt;em-&gt;getRepository(Product::class)-&gt;createQueryBuilder('t')
  -&gt;leftJoin('t.deletedByCompanies', 'deletedCompany')
  -&gt;andWhere('deletedCompany.id not in (:companyId)')
  -&gt;setParameter('companyId', [$companyId]);
  </code></pre>
  
  <p>But this simply does not return anything.
  Schema is pretty straghtforward:</p>
  
  <pre><code>Product:
     id: int PK
  
  Company:
     id: int PK
  
  DeletedProducts
     product_id: int FK
     company_id: int FK
  </code></pre>
  
  <p>Entity definition in Product class:</p>
  
  <pre><code>/**
   * @var Company[]
   * @ORM\ManyToMany(targetEntity="Company", indexBy="id")
   * @ORM\JoinTable(name="DeletedProducts")
   */
  protected $deletedByCompanies;
  </code></pre>