Skip to content

Commit fd69d96

Browse files
authored
Merge branch '5.0' into merge-4.8-into-5.0-1732116585465
2 parents 0af5611 + d383822 commit fd69d96

File tree

85 files changed

+1283
-1308
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+1283
-1308
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,3 @@ This will help reviewers and should be a good start for the documentation.
77

88
- [ ] Add tests and ensure they pass
99
- [ ] Add an entry to the CHANGELOG.md file
10-
- [ ] Update documentation for new features

.github/workflows/merge-up.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Merge up
33
on:
44
push:
55
branches:
6-
- "[0-9]+.[0-9]+"
6+
- "[0-9]+.[0-9x]+"
77

88
env:
99
GH_TOKEN: ${{ secrets.MERGE_UP_TOKEN }}
@@ -28,4 +28,5 @@ jobs:
2828
with:
2929
ref: ${{ github.ref_name }}
3030
branchNamePattern: '<major>.<minor>'
31+
devBranchNamePattern: '<major>.x'
3132
enableAutoMerge: true

.github/workflows/static-analysis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ jobs:
2323
php:
2424
- '8.1'
2525
- '8.2'
26+
- '8.3'
2627
steps:
2728
- name: Checkout
2829
uses: actions/checkout@v4

CHANGELOG.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,25 @@
11
# Changelog
22
All notable changes to this project will be documented in this file.
33

4+
## [5.0.2] - 2024-09-17
5+
6+
* Fix missing return types in CommandSubscriber by @GromNaN in [#3158](https://github.com/mongodb/laravel-mongodb/pull/3158)
7+
8+
## [5.0.1] - 2024-09-13
9+
10+
* Restore support for Laravel 10 by @GromNaN in [#3148](https://github.com/mongodb/laravel-mongodb/pull/3148)
11+
12+
## [5.0.0] - 2024-09-12
13+
14+
* **BREAKING CHANGE** Use `id` as an alias for `_id` in commands and queries for compatibility with Eloquent packages by @GromNaN in [#3040](https://github.com/mongodb/laravel-mongodb/pull/3040) and [#3136](https://github.com/mongodb/laravel-mongodb/pull/3136)
15+
* **BREAKING CHANGE** Make Query\Builder return objects instead of array to match Laravel behavior by @GromNaN in [#3107](https://github.com/mongodb/laravel-mongodb/pull/3107)
16+
* **BREAKING CHANGE** In DB query results, convert BSON `UTCDateTime` objects into `Carbon` date with the default timezone by @GromNaN in [#3119](https://github.com/mongodb/laravel-mongodb/pull/3119)
17+
* Remove `MongoFailedJobProvider`, replaced by Laravel `DatabaseFailedJobProvider` by @GromNaN in [#3122](https://github.com/mongodb/laravel-mongodb/pull/3122)
18+
* Remove custom `PasswordResetServiceProvider`, use the default `DatabaseTokenRepository` by @GromNaN in [#3124](https://github.com/mongodb/laravel-mongodb/pull/3124)
19+
* Remove `Blueprint::background()` method by @GromNaN in [#3132](https://github.com/mongodb/laravel-mongodb/pull/3132)
20+
* Replace `Collection` proxy class with Driver monitoring by @GromNaN in [#3137]((https://github.com/mongodb/laravel-mongodb/pull/3137)
21+
* Support options in `count()` queries by @verduck in [#3142](https://github.com/mongodb/laravel-mongodb/pull/3142)
22+
423
## [4.8.0] - 2024-08-27
524

625
* Add `Query\Builder::incrementEach()` and `decrementEach()` methods by @SmallRuralDog in [#2550](https://github.com/mongodb/laravel-mongodb/pull/2550)

composer.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
"illuminate/database": "^10.30|^11",
3131
"illuminate/events": "^10.0|^11",
3232
"illuminate/support": "^10.0|^11",
33-
"mongodb/mongodb": "^1.15"
33+
"mongodb/mongodb": "^1.18"
3434
},
3535
"require-dev": {
3636
"mongodb/builder": "^0.2",
@@ -41,7 +41,8 @@
4141
"mockery/mockery": "^1.4.4",
4242
"doctrine/coding-standard": "12.0.x-dev",
4343
"spatie/laravel-query-builder": "^5.6",
44-
"phpstan/phpstan": "^1.10"
44+
"phpstan/phpstan": "^1.10",
45+
"rector/rector": "^1.2"
4546
},
4647
"conflict": {
4748
"illuminate/bus": "< 10.37.2"
@@ -68,7 +69,6 @@
6869
"laravel": {
6970
"providers": [
7071
"MongoDB\\Laravel\\MongoDBServiceProvider",
71-
"MongoDB\\Laravel\\MongoDBQueueServiceProvider",
7272
"MongoDB\\Laravel\\MongoDBBusServiceProvider"
7373
]
7474
}
@@ -77,7 +77,8 @@
7777
"test": "phpunit",
7878
"test:coverage": "phpunit --coverage-clover ./coverage.xml",
7979
"cs": "phpcs",
80-
"cs:fix": "phpcbf"
80+
"cs:fix": "phpcbf",
81+
"rector": "rector"
8182
},
8283
"config": {
8384
"allow-plugins": {

docs/compatibility.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Compatibility
1515
:class: singlecol
1616

1717
.. meta::
18-
:keywords: laravel 9, laravel 10, laravel 11, 4.0, 4.1, 4.2
18+
:keywords: laravel 9, laravel 10, laravel 11, 4.0, 4.1, 4.2, 5.0
1919

2020
Laravel Compatibility
2121
---------------------

docs/eloquent-models/model-class.txt

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -216,8 +216,8 @@ model attribute, stored in MongoDB as a :php:`MongoDB\\BSON\\UTCDateTime
216216
To learn more, see `Attribute Casting <https://laravel.com/docs/{+laravel-docs-version+}/eloquent-mutators#attribute-casting>`__
217217
in the Laravel documentation.
218218

219-
This conversion lets you use the PHP :php:`DateTime <class.datetime>`
220-
or the `Carbon class <https://carbon.nesbot.com/docs/>`__ to work with dates
219+
This conversion lets you use the PHP :php:`DateTime
220+
<class.datetime>` class to work with dates
221221
in this field. The following example shows a Laravel query that uses the
222222
casting helper on the model to query for planets with a ``discovery_dt`` of
223223
less than three years ago:
@@ -226,6 +226,13 @@ less than three years ago:
226226

227227
Planet::where( 'discovery_dt', '>', new DateTime('-3 years'))->get();
228228

229+
.. note:: Carbon Date Class
230+
231+
Starting in {+odm-long+} v5.0, ``UTCDateTime`` BSON values in MongoDB
232+
are returned as `Carbon <https://carbon.nesbot.com/docs/>`__ date
233+
classes in query results. The {+odm-short+} applies the default
234+
timezone when performing this conversion.
235+
229236
To learn more about MongoDB's data types, see :manual:`BSON Types </reference/bson-types/>`
230237
in the Server manual.
231238

@@ -295,12 +302,8 @@ including this trait, you can make the third-party class compatible with
295302
MongoDB.
296303

297304
When you apply the ``DocumentModel`` trait to a model class, you must
298-
declare the following properties in your class:
299-
300-
- ``$primaryKey = '_id'``, because the ``_id`` field uniquely
301-
identifies MongoDB documents
302-
- ``$keyType = 'string'``, because the {+odm-short+} casts MongoDB
303-
``ObjectId`` values to type ``string``
305+
set the ``$keyType`` property to ``'string'`` as the {+odm-short+}
306+
casts MongoDB ``ObjectId`` values to type ``string``.
304307

305308
Extended Class Example
306309
~~~~~~~~~~~~~~~~~~~~~~

docs/includes/auth/PersonalAccessToken.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,5 @@ class PersonalAccessToken extends SanctumToken
1111

1212
protected $connection = 'mongodb';
1313
protected $table = 'personal_access_tokens';
14-
protected $primaryKey = '_id';
1514
protected $keyType = 'string';
1615
}

docs/includes/eloquent-models/PlanetThirdParty.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,5 @@ class Planet extends CelestialBody
1010
use DocumentModel;
1111

1212
protected $fillable = ['name', 'diameter'];
13-
protected $primaryKey = '_id';
1413
protected $keyType = 'string';
1514
}

docs/includes/framework-compatibility-laravel.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
- Laravel 10.x
88
- Laravel 9.x
99

10-
* - 4.2 to 4.8
10+
* - 4.2 to 5.0
1111
- ✓
1212
- ✓
1313
-

0 commit comments

Comments
 (0)