mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
DDC-2398: Add a "use namespace" like feature to DQL to have short/reusable entity classname #3011
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @doctrinebot on GitHub (Apr 11, 2013).
Originally assigned to: @Ocramius on GitHub.
Jira issue originally created by user quazardous:
I find not always portable-friendly the use of full class path in DQL.
$query = $em->createQuery('SELECT u FROM \MyProject\Model\User u WHERE u.age > 20');
could be :
$query = $em->createQuery('USE \MyProject\Model SELECT u FROM User u WHERE u.age > 20');
or :
$query = $em->use('\MyProject\Model')->createQuery('SELECT u FROM User u WHERE u.age > 20');
And with a default namespace attached to the entity manager :
$query = $em->use()->createQuery('SELECT u FROM User u WHERE u.age > 20');
@doctrinebot commented on GitHub (Apr 11, 2013):
Comment created by @ocramius:
In strings, you always use the fully qualified class name, or an entity alias
@doctrinebot commented on GitHub (Apr 11, 2013):
Comment created by quazardous:
yes :p and so it's not symmetrical with PHP coding...
it's unesthetic and when you do code refactoring it's harder than just managing your use "namespace";
but i've put priority to minor ;p
@doctrinebot commented on GitHub (Apr 11, 2013):
Comment created by @ocramius:
[~quazardous] I'm closing this. Strings are values passed around in your system, and having their meaning depend on context is absolutely a no-go
@doctrinebot commented on GitHub (Apr 11, 2013):
Issue was closed with resolution "Invalid"