NOT IN query with Doctrine QueryBuilder in a Many to Many relation
问题 In my Symfony2 project, I have two entities "contact" and "settings", with a many to many relationship : /** * @ORM\ManyToMany(targetEntity="AppBundle\Entity\Settings", cascade={"persist"}) * @ORM\JoinColumn(nullable=true) */ private $settings; Entity settings have a property "parametre", which is a simple string. Now I want to get all the contacts that DON'T have any settings which "parametre" is "THEMES". I can do that in SQL with a query like : SELECT DISTINCT(c.id) FROM contact c WHERE c