[PR #1567] Allow interface in dql #9625

Open
opened 2026-01-22 16:04:53 +01:00 by admin · 0 comments
Owner

Original Pull Request: https://github.com/doctrine/orm/pull/1567

State: closed
Merged: No


When I used Target Entity Resolver, I couldn't use Entity Interface in DQL.

I had to call entityRepository::getClassName() like this:

$this->em->createQuery('SELECT a FROM ' . $this->em->getRepository(IArticle::class)->getClassName() . ' a ORDER BY a.id DESC')

Now this should work:

$this->em->createQuery('SELECT a FROM ' . IArticle::class . ' a ORDER BY a.id DESC')
**Original Pull Request:** https://github.com/doctrine/orm/pull/1567 **State:** closed **Merged:** No --- When I used Target Entity Resolver, I couldn't use Entity Interface in DQL. I had to call entityRepository::getClassName() like this: ``` php $this->em->createQuery('SELECT a FROM ' . $this->em->getRepository(IArticle::class)->getClassName() . ' a ORDER BY a.id DESC') ``` Now this should work: ``` php $this->em->createQuery('SELECT a FROM ' . IArticle::class . ' a ORDER BY a.id DESC') ```
admin added the pull-request label 2026-01-22 16:04:53 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#9625