Created
February 8, 2015 17:23
-
-
Save jesusOmar/5573b560cc533ae5c47b to your computer and use it in GitHub Desktop.
Doctrine Query Help
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$qb2 = $this->createQueryBuilder('a2') | |
->select('a2') | |
->innerJoin('a2.registrations', 'appointment_registrations') | |
->where('a2.id = a1.id') // This does not work :( | |
; | |
$qb = $this->createQueryBuilder('a1'); | |
$qb->where($qb->expr()->not($qb->expr()->exists($qb2->getDql()))); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT a1.* | |
FROM appointments a1 WHERE | |
NOT | |
( EXISTS | |
( | |
SELECT a2.* FROM appointments a2 | |
INNER JOIN appointment_registrations r on r.appointmentId = a2.id | |
WHERE a2.id = a1.id | |
) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment