Created
November 6, 2023 14:05
-
-
Save rela589n/10091d8810d5eeb6d97c50fcdda204dc to your computer and use it in GitHub Desktop.
Doctrine select EXISTS query
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
public function hasEntities(): bool | |
{ | |
$qb = $this->createYourQueryBuilder(); | |
$qb->select((string)$qb->expr()->literal('1')) | |
->setMaxResults(1); | |
$result = $qb->getQuery()->getOneOrNullResult(); | |
return null !== $result; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment