Skip to content

Commit 4de0c36

Browse files
committed
Merge remote-tracking branch 'origin/5.next' into docs-string-agg
# Conflicts: # docs/en/appendices/5-4-migration-guide.md
2 parents f367ec9 + 14db7d6 commit 4de0c36

File tree

3 files changed

+48
-4
lines changed

3 files changed

+48
-4
lines changed

docs/en/appendices/5-4-migration-guide.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ version is reported as `unknown`), the header is omitted.
4444
- The default eager loading strategy for `HasMany` and `BelongsToMany` associations
4545
has changed from `select` to `subquery`. If you need the previous behavior,
4646
explicitly set `'strategy' => 'select'` when defining associations.
47+
See [Associations](../orm/associations#has-many-associations) for more details.
4748

4849
### Controller
4950

@@ -101,6 +102,10 @@ version is reported as `unknown`), the header is omitted.
101102
- Added `FunctionsBuilder::stringAgg()` for portable string aggregation.
102103
Translates to `STRING_AGG` or `GROUP_CONCAT` per driver.
103104
See [Query Builder](../orm/query-builder#string-aggregation).
105+
- Added `except()` and `exceptAll()` methods on `SelectQuery` for `EXCEPT`
106+
and `EXCEPT ALL` set operations. `EXCEPT ALL` is supported on PostgreSQL
107+
and recent MySQL/MariaDB versions; it is not supported on SQLite or SQL Server.
108+
See [Query Builder](../orm/query-builder#except).
104109
- Added PostgreSQL index access method reflection. Non-btree indexes (`gin`,
105110
`gist`, `spgist`, `brin`, `hash`) are now reflected with an `accessMethod`
106111
field and regenerated with the correct `USING` clause. The `Index` class

docs/en/orm/associations.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -462,9 +462,12 @@ Possible keys for hasMany association arrays include:
462462
- **propertyName**: The property name that should be filled with data from the
463463
associated table into the source table results. By default, this is the
464464
underscored & plural name of the association so `comments` in our example.
465-
- **strategy**: Defines the query strategy to use. Defaults to 'subquery'. The
466-
other valid value is 'select', which uses the `IN` list of parent keys
465+
- **strategy**: Defines the query strategy to use. Defaults to `subquery`. The
466+
other valid value is `select`, which uses the `IN` list of parent keys
467467
directly instead of a subquery.
468+
::: tip New default strategy in version 5.4+
469+
The default strategy has changed from `select` to `subquery` in order to improve performance when the number of parent keys is large.
470+
:::
468471
- **saveStrategy**: Either `append` or `replace`. Defaults to `append`. When `append` the current
469472
records are appended to any records in the database. When `replace` associated
470473
records not in the current set will be removed. If the foreign key is a nullable
@@ -616,9 +619,12 @@ Possible keys for belongsToMany association arrays include:
616619
- **propertyName**: The property name that should be filled with data from the
617620
associated table into the source table results. By default, this is the
618621
underscored & plural name of the association, so `tags` in our example.
619-
- **strategy**: Defines the query strategy to use. Defaults to 'subquery'. The
620-
other valid value is 'select', which uses the `IN` list of parent keys
622+
- **strategy**: Defines the query strategy to use. Defaults to `subquery`. The
623+
other valid value is `select`, which uses the `IN` list of parent keys
621624
directly instead of a subquery.
625+
::: tip New default strategy in version 5.4+
626+
The default strategy has changed from `select` to `subquery` in order to improve performance when the number of parent keys is large.
627+
:::
622628
- **saveStrategy**: Either `append` or `replace`. Defaults to `replace`.
623629
Indicates the mode to be used for saving associated entities. The former will
624630
only create new links between both side of the relation and the latter will

docs/en/orm/query-builder.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2237,6 +2237,39 @@ $unpublished->intersectAll($inReview);
22372237
`intersect()` and `intersectAll()` were added.
22382238
:::
22392239

2240+
### Except
2241+
2242+
Except operations allow you to return rows from one query that do not appear
2243+
in another query. Except queries are created by composing one or more select
2244+
queries together:
2245+
2246+
```php
2247+
$allArticles = $articles->find();
2248+
2249+
$published = $articles->find()
2250+
->where(['published' => true]);
2251+
2252+
$allArticles->except($published);
2253+
```
2254+
2255+
You can create `EXCEPT ALL` queries using the `exceptAll()` method:
2256+
2257+
```php
2258+
$allArticles = $articles->find();
2259+
2260+
$published = $articles->find()
2261+
->where(['published' => true]);
2262+
2263+
$allArticles->exceptAll($published);
2264+
```
2265+
2266+
`EXCEPT ALL` is supported on PostgreSQL and recent MySQL/MariaDB versions.
2267+
It is not supported on SQLite or SQL Server.
2268+
2269+
::: info Added in version 5.4.0
2270+
`except()` and `exceptAll()` were added.
2271+
:::
2272+
22402273
### Subqueries
22412274

22422275
Subqueries enable you to compose queries together and build conditions and

0 commit comments

Comments
 (0)