-
-
Notifications
You must be signed in to change notification settings - Fork 37
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 callback to Query::all()
and Query::one()
#925
base: master
Are you sure you want to change the base?
Conversation
Tigrov
commented
Jan 27, 2025
Q | A |
---|---|
Is bugfix? | ❌ |
New feature? | ✔️ |
Breaks BC? | ✔️ |
Fixed issues | yiisoft/data-db#50 |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #925 +/- ##
============================================
- Coverage 99.62% 98.98% -0.65%
- Complexity 1500 1510 +10
============================================
Files 81 81
Lines 3710 3726 +16
============================================
- Hits 3696 3688 -8
- Misses 14 38 +24 ☔ View full report in Codecov by Sentry. |
@@ -115,6 +115,8 @@ Each table column has its own class in the `Yiisoft\Db\Schema\Column` namespace | |||
### New methods | |||
|
|||
- `QuoterInterface::getRawTableName()` - returns the raw table name without quotes; | |||
- `QueryInterface::callback()` - allows to use a callback, which should be called on each row of the query result; | |||
- `QueryInterface::getCallback()` - returns the callback to be called on each row of the query result or `null` if not set; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- `QueryInterface::getCallback()` - returns the callback to be called on each row of the query result or `null` if not set; | |
- `QueryInterface::getCallback()` - returns the callback to be called on each row of the query result or `null` if the callback is not set; |
@@ -250,6 +272,12 @@ public function batch(int $batchSize = 100): BatchQueryResultInterface | |||
; | |||
} | |||
|
|||
public function callback(Closure|null $callback): static |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need phpdoc with the callback signature.
/** | ||
* Sets callback, which should be called on each row of the query result. | ||
* | ||
* @psalm-param CallbackType|null $callback |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to mention callback signature.