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

make QueryBuilder::getAllAliases public #1303

Merged
merged 1 commit into from
Mar 17, 2015
Merged

make QueryBuilder::getAllAliases public #1303

merged 1 commit into from
Mar 17, 2015

Conversation

mrkrstphr
Copy link
Contributor

Being able to get all already defined aliases in the QueryBuilder can be helpful when dynamically joining.

Funny, the DocBlock makes it seem as if this method was already public.

@doctrinebot
Copy link

Hello,

thank you for creating this pull request. I have automatically opened an issue
on our Jira Bug Tracker for you. See the issue link:

http://www.doctrine-project.org/jira/browse/DDC-3567

We use Jira to track the state of pull requests and the versions they got
included in.

@Ocramius
Copy link
Member

@mrkrstphr what's the exact use-case here?

@mrkrstphr
Copy link
Contributor Author

I have a Query object which has several methods the user can call to control which data gets returned. This Query object internally uses the QueryBuilder.

Some of the methods need to join with other entities and add where clauses. I need a way to internally check if I've already joined with a table before trying to join it again. As I control the aliases internally, I can simply rely on seeing if the alias was defined.

I could keep a running list myself, but saw that the QueryBuilder object had this available and thought it'd be nice to expose that information.

@Ocramius
Copy link
Member

I need a way to internally check if I've already joined with a table before trying to join it again

Why not just using uniqid()?

@mrkrstphr
Copy link
Contributor Author

Because then I end up joining with the same entity over and over again when it's not necessary.

@Ocramius
Copy link
Member

Because then I end up joining with the same entity over and over again when it's not necessary.

This seems like an useless optimization to me, no? Shouldn't the caller code have an idea of what was already fetched in the join?

That said, I don't think there are any problems with making the method public, but you need to rebase the PR

@Ocramius Ocramius removed the WIP label Mar 17, 2015
Ocramius added a commit that referenced this pull request Mar 17, 2015
@Ocramius Ocramius merged commit 4daf383 into doctrine:master Mar 17, 2015
@Ocramius
Copy link
Member

👍

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

Successfully merging this pull request may close these issues.

4 participants