Comments (5)
FYI: I think the fix for this issue has just been merged to master :)
Instead of doing $results = $repo->match($spec);
you can now also do $query = $repo->getQuery($spec);
which solves this issue. You can now ask for a Query object if you need it or use match
if you just want results.
from doctrine-specification.
I've not considered that issue. Thank you.
I've been doing some thinking on this issue the last week but I have not come up with any good generic solution. I don't believe adding a third parameter is a good solution because I don't want to add a fourth parameter when the other feature X comes around.
I was thinking of refactor EntitySpecificationRepositoryTrait::match
somehow. But does only contain a few lines of code...
$specification->modify($qb, $alias);
$query = $qb->where($specification->getFilter($qb, $alias))->getQuery();
if ($modifier !== null) {
$modifier->modify($query);
}
I would suggest you to write your own EntitySpecificationRepository
and implement your version of match there.
from doctrine-specification.
How I handled this problem was I created a second method "getPaginator" to
the entity repository as you suggested, which takes the same parameters as
"match". To avoid repetition I moved the query building out to a protected
"getSpecificationQuery" method.
Justin Proffitt
Lead Web Programmer
719.964.7350 voice/text
LEGAL CONFIDENTIAL: All information in this e-mail and in any attachment
contains information which is legally privileged. It is provided only for
the attention and use of the named recipient. If you are not the intended
recipient, you are not authorized to retain, disclose, copy or distribute
the message and/or any of its attachments.
On Tue, Mar 17, 2015 at 5:54 AM, Tobias Nyholm [email protected]
wrote:
I've not considered that issue. Thank you.
I've been doing some thinking on this issue the last week but I have not
come up with any good generic solution. I don't believe adding a third
parameter is a good solution because I don't want to add a fourth parameter
when the other feature X comes around.I was thinking of refactor EntitySpecificationRepositoryTrait::match
somehow. But does only contain a few lines of code...$specification->modify($qb, $alias);$query = $qb->where($specification->getFilter($qb, $alias))->getQuery();if ($modifier !== null) { $modifier->modify($query);}
I would suggest you to write your own EntitySpecificationRepository and
implement your version of match there.—
Reply to this email directly or view it on GitHub
#85 (comment)
.
from doctrine-specification.
What if match() retured the Query instead of executing it?
from doctrine-specification.
Would it be overkill to let match() continue to execute the query but have a different function return the Query or QueryBuilder instead? (I've been using the match quite a bit in code that I plan to deploy to production but obviously refactoring to execute the query isn't that crazy.) I haven't used the Paginator but could see it being useful at some point.
from doctrine-specification.
Related Issues (20)
- Need remove not used vars in RoundDateTimeSpec
- Add createQueryBuilder() abstract method in EntitySpecificationRepositoryTrait HOT 1
- Remove AbstractJoin::getJoinType() method HOT 1
- [Syntax Error] line 0, col -1: Error: Expected Literal, got end of string. HOT 1
- Mysql substring function bug HOT 1
- Disable Style CI HOT 3
- Release 2.0.0 HOT 1
- Check single entity satisfiability HOT 8
- DATE_ADD() and DATE_SUB() platform functions does not work HOT 1
- TRIM() platform functions does not support options HOT 1
- Best practices and architectural decissions HOT 5
- Use defaultRepositoryClassName instead of the RepositoryFactory HOT 4
- Using subqueries HOT 5
- Always use a unique aliases to prevent cases in which we have auto-joining and reserved keywords as context HOT 4
- Psalm annotations HOT 5
- A bit confused about the proper use of `$context` HOT 2
- Customize JOIN HOT 1
- Auto-joins with dot notation HOT 7
- Symfony 6 HOT 1
- How to set Query::HINT? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from doctrine-specification.