Skip to content

Commit e08d5b5

Browse files
committed
Merge remote-tracking branch 'upstream/2.15.x' into 2.14.x-merge-up-into-2.15.x_LqPIdJa0
2 parents 92a9f3b + 48a7de7 commit e08d5b5

Some content is hidden

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

42 files changed

+510
-94
lines changed

.github/workflows/atlas-ci.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,13 @@ jobs:
1818
symfony:
1919
- "stable"
2020
proxy:
21-
- "lazy-ghost"
21+
- "native"
2222
include:
23+
# Test with LazyGhostObject
24+
- php-version: "8.2"
25+
symfony: "7.4"
26+
proxy: "lazy-ghost"
27+
os: "ubuntu-latest"
2328
# Test with ProxyManager
2429
- php-version: "8.1"
2530
symfony: "6.4"

.github/workflows/coding-standards.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ on:
1111
jobs:
1212
coding-standards:
1313
name: "Coding Standards"
14-
uses: "doctrine/.github/.github/workflows/coding-standards.yml@12.1.0"
14+
uses: "doctrine/.github/.github/workflows/coding-standards.yml@v12.2.0"

.github/workflows/continuous-integration.yml

Lines changed: 28 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
dependencies:
3535
- "highest"
3636
symfony-version:
37-
- "stable"
37+
- "locked"
3838
proxy:
3939
- "lazy-ghost"
4040
include:
@@ -44,7 +44,7 @@ jobs:
4444
mongodb-version: "6.0"
4545
driver-version: "1.21.0"
4646
topology: "server"
47-
symfony-version: "stable"
47+
symfony-version: "locked"
4848
proxy: "lazy-ghost"
4949
# Test with Symfony 6.4
5050
- topology: "server"
@@ -60,45 +60,61 @@ jobs:
6060
mongodb-version: "6.0"
6161
driver-version: "stable"
6262
dependencies: "highest"
63-
symfony-version: "stable"
63+
symfony-version: "locked"
6464
proxy: "lazy-ghost"
6565
# Test with a 8.0 replica set
6666
- topology: "replica_set"
6767
php-version: "8.2"
6868
mongodb-version: "8.0"
6969
driver-version: "stable"
7070
dependencies: "highest"
71-
symfony-version: "stable"
71+
symfony-version: "locked"
7272
proxy: "lazy-ghost"
7373
# Test with ProxyManager
7474
- php-version: "8.2"
7575
mongodb-version: "6.0"
7676
driver-version: "stable"
7777
dependencies: "highest"
78-
symfony-version: "stable"
78+
symfony-version: "locked"
7979
proxy: "proxy-manager"
8080
# Test with Native Lazy Objects
8181
- php-version: "8.4"
8282
mongodb-version: "8.0"
8383
driver-version: "stable"
8484
dependencies: "highest"
85-
symfony-version: "stable"
85+
symfony-version: "locked"
8686
proxy: "native"
8787
# Test with extension 1.21
8888
- topology: "server"
8989
php-version: "8.2"
9090
mongodb-version: "8.0"
9191
driver-version: "1.21.0"
9292
dependencies: "highest"
93-
symfony-version: "stable"
93+
symfony-version: "locked"
94+
proxy: "lazy-ghost"
95+
# Test with Symfony 7.4 LTS
96+
- topology: "server"
97+
php-version: "8.2"
98+
mongodb-version: "8.0"
99+
driver-version: "stable"
100+
dependencies: "highest"
101+
symfony-version: "7.4"
94102
proxy: "lazy-ghost"
103+
# Test with Symfony 8
104+
- topology: "server"
105+
php-version: "8.4"
106+
mongodb-version: "8.0"
107+
driver-version: "stable"
108+
dependencies: "highest"
109+
symfony-version: false
110+
proxy: "native"
95111
# Test removing optional dependencies
96112
- topology: "server"
97113
php-version: "8.4"
98114
mongodb-version: "8.0"
99115
driver-version: "stable"
100116
dependencies: "highest"
101-
symfony-version: "stable"
117+
symfony-version: "locked"
102118
proxy: "native"
103119
remove-optional-dependencies: true
104120
# Test with a sharded cluster
@@ -108,7 +124,7 @@ jobs:
108124
# mongodb-version: "6.0"
109125
# driver-version: "stable"
110126
# dependencies: "highest"
111-
# symfony-version: "stable"
127+
# symfony-version: "locked"
112128
# proxy: "lazy-ghost"
113129

114130
steps:
@@ -136,27 +152,17 @@ jobs:
136152
uses: "shivammathur/setup-php@v2"
137153
with:
138154
php-version: "${{ matrix.php-version }}"
139-
tools: "pecl"
140155
extensions: "mongodb-${{ matrix.driver-version }}, bcmath"
141156
coverage: "none"
142157
ini-values: "zend.assertions=1"
143158

144159
- name: "Show driver information"
145160
run: "php --ri mongodb"
146161

147-
# Not used, skip transient dependencies
162+
# Not used for tests, skip transient dependencies
148163
- name: "Remove phpbench/phpbench"
149164
run: composer remove --no-update --dev phpbench/phpbench
150165

151-
- name: "Configure Symfony ${{ matrix.symfony-version }}"
152-
if: "${{ matrix.symfony-version != 'stable' }}"
153-
run: |
154-
composer config minimum-stability dev
155-
# update symfony deps
156-
composer require --no-update symfony/console:^${{ matrix.symfony-version }}
157-
composer require --no-update symfony/var-dumper:^${{ matrix.symfony-version }}
158-
composer require --no-update --dev symfony/cache:^${{ matrix.symfony-version }}
159-
160166
- name: "Remove optional dependencies"
161167
if: "${{ matrix.remove-optional-dependencies }}"
162168
run: |
@@ -169,6 +175,8 @@ jobs:
169175
with:
170176
dependency-versions: "${{ matrix.dependencies }}"
171177
composer-options: "--prefer-dist"
178+
env:
179+
SYMFONY_REQUIRE: ${{ matrix.symfony-version }}
172180

173181
- name: "Install latest Python version"
174182
uses: actions/setup-python@v6

.github/workflows/documentation.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ on:
1717
jobs:
1818
documentation:
1919
name: "Generate documentation"
20-
uses: "doctrine/.github/.github/workflows/documentation.yml@12.1.0"
20+
uses: "doctrine/.github/.github/workflows/documentation.yml@v12.2.0"

.github/workflows/release-on-milestone-closed.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88
jobs:
99
release:
1010
name: "Git tag, release & create merge-up PR"
11-
uses: "doctrine/.github/.github/workflows/release-on-milestone-closed.yml@12.1.0"
11+
uses: "doctrine/.github/.github/workflows/release-on-milestone-closed.yml@v12.2.0"
1212
with:
1313
use-next-minor-as-default-branch: true
1414
secrets:

.github/workflows/website-schema.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ on:
1818
jobs:
1919
json-validate:
2020
name: "Validate JSON schema"
21-
uses: "doctrine/.github/.github/workflows/website-schema.yml@12.1.0"
21+
uses: "doctrine/.github/.github/workflows/website-schema.yml@v12.2.0"

composer.json

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
"mapping",
1212
"object"
1313
],
14+
"minimum-stability": "dev",
15+
"prefer-stable": true,
1416
"homepage": "https://www.doctrine-project.org/projects/mongodb-odm.html",
1517
"license": "MIT",
1618
"authors": [
@@ -35,10 +37,10 @@
3537
"jean85/pretty-package-versions": "^1.3.0 || ^2.0.1",
3638
"mongodb/mongodb": "^1.21.2 || ^2.1.1",
3739
"psr/cache": "^1.0 || ^2.0 || ^3.0",
38-
"symfony/console": "^5.4 || ^6.0 || ^7.0",
40+
"symfony/console": "^5.4 || ^6.4 || ^7.0 || ^8.0",
3941
"symfony/deprecation-contracts": "^2.2 || ^3.0",
40-
"symfony/var-dumper": "^5.4 || ^6.0 || ^7.0",
41-
"symfony/var-exporter": "^6.2 || ^7.0"
42+
"symfony/var-dumper": "^5.4 || ^6.4 || ^7.0 || ^8.0",
43+
"symfony/var-exporter": "^6.4 || ^7.0 || ^8.0"
4244
},
4345
"require-dev": {
4446
"ext-bcmath": "*",
@@ -50,10 +52,10 @@
5052
"phpstan/phpstan": "^2.1",
5153
"phpstan/phpstan-deprecation-rules": "^2.0",
5254
"phpstan/phpstan-phpunit": "^2.0",
53-
"phpunit/phpunit": "^10.5.58",
55+
"phpunit/phpunit": "^10.5.58|^11.5.43",
5456
"squizlabs/php_codesniffer": "^4",
55-
"symfony/cache": "^5.4 || ^6.0 || ^7.0",
56-
"symfony/uid": "^5.4 || ^6.0 || ^7.0"
57+
"symfony/cache": "^5.4 || ^6.0 || ^7.0 || ^8.0",
58+
"symfony/uid": "^5.4 || ^6.0 || ^7.0 || ^8.0"
5759
},
5860
"conflict": {
5961
"doctrine/annotations": "<1.12 || >=3.0"

docs/en/reference/console-commands.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Console Commands
22
================
33

4-
Doctrine MongoDB ODM offers some console commands, which utilize Symfony2's
4+
Doctrine MongoDB ODM offers some console commands, which utilize Symfony's
55
Console component, to ease your development process:
66

77
- ``odm:clear-cache:metadata`` - Clear all metadata cache of the various cache drivers.

docs/en/reference/query-builder-api.rst

Lines changed: 44 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -641,8 +641,7 @@ change document field values atomically. Additionally if you are modifying a fie
641641
that is a reference you can pass managed document to the Builder and let ODM build
642642
``DBRef`` object for you.
643643

644-
You have several modifier operations
645-
available to you that make it easy to update documents in Mongo:
644+
The following atomic update operators are available through the builder API:
646645

647646
* ``set($name, $value, $atomic = true)``
648647
* ``setNewObj($newObj)``
@@ -655,6 +654,49 @@ available to you that make it easy to update documents in Mongo:
655654
* ``pull($field, $value)``
656655
* ``pullAll($field, array $valueArray)``
657656

657+
You can also run `updates with Aggregation Pipeline <https://www.mongodb.com/docs/manual/tutorial/update-documents-with-aggregation-pipeline/>`_
658+
by using the ``pipeline()`` method. You can pass an aggregation builder instance, a ``Pipeline`` instance from the
659+
MongoDB PHP library, or an array of pipeline stages:
660+
661+
.. code-block:: php
662+
663+
<?php
664+
665+
// The three following are equivalent ways to define the same update pipeline stage
666+
667+
$pipeline = $dm->createAggregationBuilder(User::class)
668+
->set()
669+
->field('totalScore')
670+
->add('$score1', '$score2'),
671+
);
672+
673+
$pipeline = new Pipeline(
674+
Stage::set(
675+
totalScore: Expression::add(
676+
Expression::fieldPath('score1'),
677+
Expression::fieldPath('score2'),
678+
),
679+
)
680+
);
681+
682+
$pipeline = [
683+
['$set' => [
684+
'totalScore' => ['$add' => ['$score1', '$score2']],
685+
]],
686+
]
687+
688+
$dm->createQueryBuilder(User::class)
689+
->updateOne()
690+
->field('username')->equals('jwage')
691+
->pipeline($pipeline)
692+
->getQuery()
693+
->execute();
694+
695+
.. note::
696+
697+
Pipeline updates are only available for ``updateOne``, ``updateMany``, and ``findAndUpdate`` operations.
698+
699+
658700
Updating multiple documents
659701
---------------------------
660702

phpcs.xml.dist

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@
6868
<rule ref="PSR1.Classes.ClassDeclaration.MultipleClasses">
6969
<exclude-pattern>src/Mapping/Driver/CompatibilityAnnotationDriver.php</exclude-pattern>
7070
<exclude-pattern>src/Tools/Console/Command/CommandCompatibility.php</exclude-pattern>
71+
<exclude-pattern>src/Tools/Console/Command/Schema/AbstractCommandCompatibility.php</exclude-pattern>
7172
<exclude-pattern>src/Tools/Console/Helper/DocumentManagerHelper.php</exclude-pattern>
7273
<exclude-pattern>tests/*</exclude-pattern>
7374
</rule>

0 commit comments

Comments
 (0)