Skip to content

Commit

Permalink
Merge branch '4.10' of https://github.com/craftcms/cms into 5.2
Browse files Browse the repository at this point in the history
# Conflicts:
#	CHANGELOG-WIP.md
#	src/elements/ElementCollection.php
#	src/elements/db/AddressQuery.php
#	src/elements/db/AssetQuery.php
#	src/elements/db/CategoryQuery.php
#	src/elements/db/ElementQuery.php
#	src/elements/db/EntryQuery.php
#	src/elements/db/GlobalSetQuery.php
#	src/elements/db/MatrixBlockQuery.php
#	src/elements/db/TagQuery.php
#	src/elements/db/UserQuery.php
  • Loading branch information
brandonkelly committed May 24, 2024
2 parents c56867d + 0fbc77b commit be0b6dd
Show file tree
Hide file tree
Showing 12 changed files with 642 additions and 65 deletions.
14 changes: 14 additions & 0 deletions CHANGELOG-WIP.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,20 @@
- Set the language of the Craft edition in the footer, to improve screen reader pronunciation for non-English languages.
- The accessible name of “Select site” buttons is now translated to the current language.

### Development
- Added `craft\elements\ElementCollection::find()`, which can return an element or elements in the collection based on a given element or ID. ([#15023](https://github.com/craftcms/cms/discussions/15023))
- Added `craft\elements\ElementCollection::fresh()`, which reloads each of the collection elements from the database. ([#15023](https://github.com/craftcms/cms/discussions/15023))
- `craft\elements\ElementCollection::contains()` now returns `true` if an element is passed in and the collection contains an element with the same ID and site ID; or if an integer is passed in and the collection contains an element with the same ID. ([#15023](https://github.com/craftcms/cms/discussions/15023))
- `craft\elements\ElementCollection::countBy()`, `collapse()`, `flatten()`, `keys()`, `pad()`, `pluck()`, and `zip()` now return an `Illuminate\Support\Collection` object. ([#15023](https://github.com/craftcms/cms/discussions/15023))
- `craft\elements\ElementCollection::diff()` and `intersect()` now compare the passed-in elements to the collection elements by their IDs and site IDs. ([#15023](https://github.com/craftcms/cms/discussions/15023))
- `craft\elements\ElementCollection::flip()` now throws an exception, as element objects can’t be used as array keys. ([#15023](https://github.com/craftcms/cms/discussions/15023))
- `craft\elements\ElementCollection::map()` and `mapWithKeys()` now return an `Illuminate\Support\Collection` object, if any of the mapped values aren’t elements. ([#15023](https://github.com/craftcms/cms/discussions/15023))
- `craft\elements\ElementCollection::merge()` now replaces any elements in the collection with passed-in elements, if their ID and site ID matches. ([#15023](https://github.com/craftcms/cms/discussions/15023))
- `craft\elements\ElementCollection::only()` and `except()` now compare the passed-in values to the collection elements by their IDs, if an integer or array of integers is passed in. ([#15023](https://github.com/craftcms/cms/discussions/15023))
- `craft\elements\ElementCollection::unique()` now returns all elements with unique IDs, if no key is passed in. ([#15023](https://github.com/craftcms/cms/discussions/15023))

### Extensibility
- Improved type definitions for `craft\db\Query`, element queries, and `craft\elements\ElementCollection`.
- Added `craft\db\getBackupFormat()`.
- Added `craft\db\getRestoreFormat()`.
- Added `craft\db\setBackupFormat()`.
Expand All @@ -45,6 +58,7 @@
- Added `craft\helpers\StringHelper::indent()`.
- Added `craft\queue\Queue::getJobId()`.
- `craft\base\Element::defineTableAttributes()` now returns common attribute definitions used by most element types.
- `craft\elements\ElementCollection::with()` now supports collections made up of multiple element types.
- Added the `reloadOnBroadcastSave` setting to `Craft.ElementEditor`. ([#14814](https://github.com/craftcms/cms/issues/14814))
- Added the `waitForDoubleClicks` setting to `Garnish.Select`, `Craft.BaseElementIndex`, and `Craft.BaseElementIndexView`.

Expand Down
9 changes: 7 additions & 2 deletions src/db/Query.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@
/**
* Class Query
*
* @template TKey of array-key
* @template TValue
* @implements ArrayAccess<TKey, TValue>
*
* @author Pixel & Tonic, Inc. <[email protected]>
* @since 3.0.0
*/
Expand Down Expand Up @@ -244,6 +248,7 @@ public function pairs(?YiiConnection $db = null): array

/**
* @inheritdoc
* @return array<TKey,TValue>
*/
public function all($db = null): array
{
Expand All @@ -259,7 +264,7 @@ public function all($db = null): array
*
* @param YiiConnection|null $db The database connection used to generate the SQL statement.
* If this parameter is not given, the `db` application component will be used.
* @return Collection A collection of the resulting elements.
* @return Collection<TKey,TValue> A collection of the resulting elements.
* @since 4.0.0
*/
public function collect(?YiiConnection $db = null): Collection
Expand All @@ -269,7 +274,7 @@ public function collect(?YiiConnection $db = null): Collection

/**
* @inheritdoc
* @return array|null
* @return TValue|null
*/
public function one($db = null): mixed
{
Expand Down
Loading

0 comments on commit be0b6dd

Please sign in to comment.