-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Introduce fetch* methods in query builder #4489
Introduce fetch* methods in query builder #4489
Conversation
Yes, please do. It could be a set of unit tests that all use the same
You can copy-paste the description of the corresponding |
To be in sync - are you suggest a "fill" query builder with some data and use the mock connection with a strictly expected query to be bypassed to the needed method? Example (expected query and other will be parametrized from data provider): protected function setUp(): void
{
$this->conn = $this->createMock(Connection::class);
}
public function testFetchAssociative(): void
{
$qb = new QueryBuilder($this->conn);
$this->conn->expects($this->once())
->method('fetchAssociative')
->with('SELECT some FROM table');
$qb->select('some')
->from('table')
->fetchAssociative();
} Thank you for help. |
Yeah, the above looks good. You can also add the assertions that not only the query but the parameters and types are passed downstream, and the value returned by the statement is returned. This is as much as these new methods do. |
As for the target branch, there's no plan to tag any new |
9c80e69
to
d8ce32a
Compare
Tests added. |
Looks good, @andrew-demb. Please squash, and I can merge it. Or I can squash it before the merge. |
I think this PR lacks the addition of a new method |
6f4e141
to
0f9efe3
Compare
This PR doesn't deprecate anything so it's complete by just adding new methods. If you want to work on the deprecation, in addition to |
@morozov thank you for squash @PowerKiKi sorry, I missed your messages before. I think a new deprecation and more methods may require an additional discussion. |
Summary
Added new
fetch*
methods (all non-deprecated fetch* methods from Connection class) to allow the use of better typing in fetching data.Please let me know if I should write some tests and what to use in the description of the methods.