First, I must emphasize that usually you should JOIN an object property (i.e. s ), for example. instead:
SELECT s FROM VendorMyBundle:EntityA s LEFT JOIN VendorMyOtherBundle:EntityB u WHERE u IS NULL
you should get something like:
SELECT s FROM VendorMyBundle:EntityA s LEFT JOIN s.mylistofb u WHERE u IS NULL
where I assume that in entity A you defined your relationship as:
class A{ // ... /** * @ManyToMany(targetEntity="Vendor\MyBundle\Entity\EntityB") * @JoinTable(name="as_bs", * joinColumns={@JoinColumn(name="a_id", referencedColumnName="id")}, * inverseJoinColumns={@JoinColumn(name="b_id", referencedColumnName="id", unique=true)} * ) **/ private $mylistofb;
This is indicated if the request does not work yet, try the following:
SELECT s FROM VendorMyBundle:EntityA s WHERE SIZE(s.mylistofb) < 1
This is the simplest than the previous one, as well as from official white papers (i.e. see phonenumbers example).
source share