Skip to content

Commit 3eb03d7

Browse files
committed
Update query builder docs.
1 parent 1fd21ae commit 3eb03d7

1 file changed

Lines changed: 18 additions & 2 deletions

File tree

guides/query-builder.md

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@ This is the second-half of the `query()` method. executes a prepared statement a
5555

5656
## Shorthand helpers
5757

58-
> `Pdb::get($table, $id): array`
58+
> `Pdb::get($table, $id, $throw = true): array`
5959
60-
This fetches a table row by ID. If the row doesn't exit it throws a `RowMissingException`.
60+
This fetches a table row by ID. Given `$throw` it raises `RowMissingException` if the row is missing.
6161

6262

6363
> `Pdb::lookup($table, $conditions, $order, $name): array`
@@ -212,6 +212,16 @@ Set the offset of a query.
212212
Specify `offset(null)` to clear an existing offset.
213213

214214

215+
> `with($subQuery, $alias)`
216+
217+
Prefix the query with `WITH alias AS (...)`.
218+
219+
220+
> `union($query)`
221+
222+
Perform a union with this query.
223+
224+
215225
> `find($table, $conditions)`
216226
217227
This is a shorthand that combines the filters `->from($table)->where($conditions)`.
@@ -234,6 +244,7 @@ Valid terminators:
234244
- `keyed(): object[]`
235245
- `iterator(): iterable<object>`
236246
- `batch($size): iterable<object[]>`
247+
- `each($size): iterable<object>`
237248

238249

239250
> `cache($key, $ttl)`
@@ -341,6 +352,11 @@ can build classes
341352
can build classes
342353

343354

355+
> `each($size): iterable<array>`
356+
357+
can build classes
358+
359+
344360
### Storing Queries
345361

346362
Query configurations can be stored as an array (or JSON blob) for later use or transport.

0 commit comments

Comments
 (0)