Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DDC-2398: Add a "use namespace" like feature to DQL to have short/reusable entity classname #3107

Closed
doctrinebot opened this issue Apr 11, 2013 · 4 comments
Assignees

Comments

@doctrinebot
Copy link

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
Copy link
Author

Comment created by @Ocramius:

In strings, you always use the fully qualified class name, or an entity alias

@doctrinebot
Copy link
Author

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
Copy link
Author

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
Copy link
Author

Issue was closed with resolution "Invalid"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants