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

add optional QueryBuilder #3

Closed
wants to merge 1 commit into from
Closed

add optional QueryBuilder #3

wants to merge 1 commit into from

Conversation

garak
Copy link

@garak garak commented Jul 24, 2015

@sagikazarmark
Copy link
Contributor

This class is getting more and more complex. @Baachi shouldn't we split it into more parts?

@Baachi
Copy link
Contributor

Baachi commented Jul 24, 2015

@sagikazarmark Split this big class in some smaller classes is a good idea.

@sagikazarmark
Copy link
Contributor

One possible way is to split by query origin: DQL, QueryBuilder. In the end, they all produce an iterable result.

@sagikazarmark
Copy link
Contributor

Looking at #1 it seems to me that internally a query builder will be used.

Also, looking at the proposed constructor: does the objectName parameter make any sense if a query builder is passed as a third argument?

So my idea is to be able to set a query for the reader after it is initiated, for example:

  • setQueryFor('Object\Name')
  • setQueryBuilder(<queryBuilder>)

@garak
Copy link
Author

garak commented Jul 26, 2015

The idea is to reserve the third parameter for more advanced needs. So, if you simply need to get all entities, you can go with objectName; if you instead need something more complex, you need to pass the QueryBuilder

@sagikazarmark
Copy link
Contributor

sagikazarmark commented Jul 26, 2015 via email

@garak
Copy link
Author

garak commented Jul 26, 2015

You need it anyway in getFields method

@sagikazarmark
Copy link
Contributor

sagikazarmark commented Jul 26, 2015 via email

@garak
Copy link
Author

garak commented Jul 26, 2015

It looks to me like an ugly hack

@sagikazarmark
Copy link
Contributor

sagikazarmark commented Jul 26, 2015 via email

@garak
Copy link
Author

garak commented Jul 26, 2015

Well, if other repos are wrong, I don't see a reason for being wrong: it's better to take fields info from metadata.
We could add a check for consistency in querybuilder object, but the approach in querybuilder is that such checks are out of its responsibility

@sagikazarmark
Copy link
Contributor

sagikazarmark commented Jul 26, 2015 via email

@garak
Copy link
Author

garak commented Jul 26, 2015

Redundancy is a price for flexibility.
Fetching data when you can avoid fetching is a waste.

@sagikazarmark
Copy link
Contributor

sagikazarmark commented Jul 26, 2015 via email

@Baachi
Copy link
Contributor

Baachi commented Jul 27, 2015

First of all i would only allow a QueryInterface, this is more flexible for users who didn't use the query builder.

The thing is, it's not really easy to implement that. If you pass a query instance to it, which use joins or something similar or a subquery in the select clause it will fail,
because you only get the metadata from the passed object or from the first result. Why not pass simple an Criteria object? This should bring more flexibilty to this reader.

@sagikazarmark
Copy link
Contributor

sagikazarmark commented Jul 27, 2015 via email

@ddeboer
Copy link
Member

ddeboer commented May 15, 2019

Replaced with #12.

@ddeboer ddeboer closed this May 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants