Skip to content

Commit 3fb65d3

Browse files
authored
Merge pull request #2722 from doctrine/2.10.x-merge-up-into-3.0.x_FMpx0dz3
Merge release 2.10.0 into 3.0.x
2 parents 39c5285 + 434b6ec commit 3fb65d3

File tree

140 files changed

+2212
-1495
lines changed

Some content is hidden

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

140 files changed

+2212
-1495
lines changed

.doctrine-project.json

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,31 @@
66
"docsSlug": "doctrine-mongodb-odm",
77
"versions": [
88
{
9-
"name": "2.9",
10-
"branchName": "2.9.x",
9+
"name": "2.10",
10+
"branchName": "2.10.x",
1111
"slug": "latest",
1212
"upcoming": true,
1313
"aliases": [
14+
"2.10.x"
15+
]
16+
},
17+
{
18+
"name": "2.9",
19+
"branchName": "2.9.x",
20+
"slug": "2.9",
21+
"current": true,
22+
"aliases": [
23+
"current",
24+
"stable",
1425
"2.9.x"
1526
]
1627
},
1728
{
1829
"name": "2.8",
1930
"branchName": "2.8.x",
2031
"slug": "2.8",
21-
"current": true,
32+
"maintained": false,
2233
"aliases": [
23-
"current",
24-
"stable",
2534
"2.8.x"
2635
]
2736
},

.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@5.0.1"
14+
uses: "doctrine/.github/.github/workflows/coding-standards.yml@7.1.0"

.github/workflows/continuous-integration.yml

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ jobs:
2121
- "8.1"
2222
- "8.2"
2323
- "8.3"
24+
- "8.4"
2425
mongodb-version:
2526
- "7.0"
2627
- "6.0"
@@ -33,6 +34,8 @@ jobs:
3334
- "highest"
3435
symfony-version:
3536
- "stable"
37+
proxy:
38+
- "lazy-ghost"
3639
include:
3740
# Test against lowest dependencies
3841
- dependencies: "lowest"
@@ -41,27 +44,39 @@ jobs:
4144
driver-version: "1.17.0"
4245
topology: "server"
4346
symfony-version: "stable"
47+
proxy: "lazy-ghost"
4448
# Test with highest dependencies
4549
- topology: "server"
4650
php-version: "8.2"
4751
mongodb-version: "7.0"
4852
driver-version: "stable"
4953
dependencies: "highest"
5054
symfony-version: "7"
55+
proxy: "lazy-ghost"
5156
# Test with a 5.0 replica set
5257
- topology: "replica_set"
5358
php-version: "8.2"
5459
mongodb-version: "5.0"
5560
driver-version: "stable"
5661
dependencies: "highest"
5762
symfony-version: "stable"
58-
# Test with a 5.0 sharded cluster
59-
- topology: "sharded_cluster"
60-
php-version: "8.2"
63+
proxy: "lazy-ghost"
64+
# Test with ProxyManager
65+
- php-version: "8.2"
6166
mongodb-version: "5.0"
6267
driver-version: "stable"
6368
dependencies: "highest"
6469
symfony-version: "stable"
70+
proxy: "proxy-manager"
71+
# Test with a 5.0 sharded cluster
72+
# Currently disabled due to a bug where MongoDB reports "sharding status unknown"
73+
# - topology: "sharded_cluster"
74+
# php-version: "8.2"
75+
# mongodb-version: "5.0"
76+
# driver-version: "stable"
77+
# dependencies: "highest"
78+
# symfony-version: "stable"
79+
# proxy: "lazy-ghost"
6580

6681
steps:
6782
- name: "Checkout"
@@ -104,8 +119,6 @@ jobs:
104119
if: "${{ matrix.symfony-version == '7' }}"
105120
run: |
106121
composer config minimum-stability dev
107-
# not yet ready for v7
108-
composer remove --no-update --dev vimeo/psalm
109122
# update symfony deps
110123
composer require --no-update symfony/console:^7@dev
111124
composer require --no-update symfony/var-dumper:^7@dev
@@ -117,12 +130,10 @@ jobs:
117130
dependency-versions: "${{ matrix.dependencies }}"
118131
composer-options: "--prefer-dist"
119132

120-
- name: "Upload composer.lock as build artifact"
121-
uses: actions/upload-artifact@v4
133+
- name: "Install latest Python version"
134+
uses: actions/setup-python@v5
122135
with:
123-
name: "composer-lock-phpunit-${{ matrix.php-version }}-${{ matrix.dependencies }}-${{ matrix.mongodb-version }}"
124-
path: composer.lock
125-
overwrite: true
136+
python-version: '3.13'
126137

127138
- id: setup-mongodb
128139
uses: mongodb-labs/drivers-evergreen-tools@master
@@ -134,3 +145,4 @@ jobs:
134145
run: "vendor/bin/phpunit"
135146
env:
136147
DOCTRINE_MONGODB_SERVER: ${{ steps.setup-mongodb.outputs.cluster-uri }}
148+
USE_LAZY_GHOST_OBJECTS: ${{ matrix.proxy == 'lazy-ghost' && '1' || '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@5.0.1"
11+
uses: "doctrine/.github/.github/workflows/release-on-milestone-closed.yml@7.1.0"
1212
secrets:
1313
GIT_AUTHOR_EMAIL: ${{ secrets.GIT_AUTHOR_EMAIL }}
1414
GIT_AUTHOR_NAME: ${{ secrets.GIT_AUTHOR_NAME }}

.github/workflows/static-analysis.yml

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -59,36 +59,3 @@ jobs:
5959

6060
- name: "Run a static analysis with phpstan/phpstan"
6161
run: "vendor/bin/phpstan analyse --error-format=github"
62-
63-
static-analysis-psalm:
64-
name: "Static Analysis with Psalm"
65-
runs-on: "ubuntu-22.04"
66-
67-
strategy:
68-
matrix:
69-
php-version:
70-
- "8.2"
71-
72-
steps:
73-
- name: "Checkout code"
74-
uses: "actions/checkout@v4"
75-
76-
- name: "Install PHP"
77-
uses: "shivammathur/setup-php@v2"
78-
with:
79-
coverage: "none"
80-
extensions: "mongodb"
81-
php-version: "${{ matrix.php-version }}"
82-
83-
- name: "Install dependencies with Composer"
84-
uses: "ramsey/composer-install@v3"
85-
86-
- name: "Upload composer.lock as build artifact"
87-
uses: actions/upload-artifact@v4
88-
with:
89-
name: "composer-lock-static-analysis-psalm"
90-
path: composer.lock
91-
overwrite: true
92-
93-
- name: "Run a static analysis with vimeo/psalm"
94-
run: "vendor/bin/psalm --show-info=false --stats --output-format=github --threads=$(nproc)"

.github/workflows/website-schema.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
2+
name: "Website config validation"
3+
4+
on:
5+
pull_request:
6+
branches:
7+
- "*.x"
8+
paths:
9+
- ".doctrine-project.json"
10+
- ".github/workflows/website-schema.yml"
11+
push:
12+
branches:
13+
- "*.x"
14+
paths:
15+
- ".doctrine-project.json"
16+
- ".github/workflows/website-schema.yml"
17+
18+
jobs:
19+
json-validate:
20+
name: "Validate JSON schema"
21+
uses: "doctrine/.github/.github/workflows/[email protected]"

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,3 @@ vendor/
1111
.phpunit.cache
1212
.phpunit.result.cache
1313
phpcs.xml
14-
psalm.xml

composer.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,15 @@
2727
"doctrine/collections": "^1.5 || ^2.0",
2828
"doctrine/event-manager": "^1.0 || ^2.0",
2929
"doctrine/instantiator": "^1.1 || ^2",
30-
"doctrine/persistence": "^3.2",
30+
"doctrine/persistence": "^3.2 || ^4",
3131
"friendsofphp/proxy-manager-lts": "^1.0",
3232
"jean85/pretty-package-versions": "^1.3.0 || ^2.0.1",
3333
"mongodb/mongodb": "^1.17.0",
3434
"psr/cache": "^1.0 || ^2.0 || ^3.0",
3535
"symfony/console": "^5.4 || ^6.0 || ^7.0",
3636
"symfony/deprecation-contracts": "^2.2 || ^3.0",
37-
"symfony/var-dumper": "^5.4 || ^6.0 || ^7.0"
37+
"symfony/var-dumper": "^5.4 || ^6.0 || ^7.0",
38+
"symfony/var-exporter": "^6.2 || ^7.0"
3839
},
3940
"require-dev": {
4041
"ext-bcmath": "*",
@@ -47,8 +48,7 @@
4748
"phpstan/phpstan-phpunit": "^1.0",
4849
"phpunit/phpunit": "^10.4",
4950
"squizlabs/php_codesniffer": "^3.5",
50-
"symfony/cache": "^5.4 || ^6.0 || ^7.0",
51-
"vimeo/psalm": "~5.24.0"
51+
"symfony/cache": "^5.4 || ^6.0 || ^7.0"
5252
},
5353
"conflict": {
5454
"doctrine/annotations": "<1.12 || >=3.0"

docs/en/cookbook/simple-search-engine.rst

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Simple Search Engine
33

44
It is very easy to implement a simple keyword search engine with MongoDB. Because of
55
its flexible schema less nature we can store the keywords we want to search through directly
6-
on the document. MongoDB is capable of indexing the embedded documents so the results are fast
6+
on the document. MongoDB is capable of indexing an array field, so the results are fast
77
and scalable.
88

99
Sample Model: Product
@@ -25,15 +25,9 @@ setup a document like the following with a ``$keywords`` property that is mapped
2525
#[Field(type: 'string')]
2626
public string $title;
2727
28-
/** @var Collection<string> */
2928
#[Field(type: 'collection')]
3029
#[Index]
31-
public Collection $keywords;
32-
33-
public function __construct()
34-
{
35-
$this->keywords = new ArrayCollection();
36-
}
30+
public array $keywords = [];
3731
}
3832
3933
Working with Keywords
@@ -47,11 +41,11 @@ Now, create a product and add some keywords:
4741
4842
$product = new Product();
4943
$product->title = 'Nike Air Jordan 2011';
50-
$product->keywords->add('nike shoes');
51-
$product->keywords->add('jordan shoes');
52-
$product->keywords->add('air jordan');
53-
$product->keywords->add('shoes');
54-
$product->keywords->add('2011');
44+
$product->keywords[] = 'nike shoes';
45+
$product->keywords[] = 'jordan shoes';
46+
$product->keywords[] = 'air jordan';
47+
$product->keywords[] = 'shoes';
48+
$product->keywords[] = '2011';
5549
5650
$dm->persist($product);
5751
$dm->flush();

0 commit comments

Comments
 (0)