Skip to content

Commit c454403

Browse files
committed
Merge branch '2.16.x' of github.com:doctrine/mongodb-odm into 2.16.x-merge-up-to-3.0.x
2 parents 61de6b2 + f36b715 commit c454403

File tree

136 files changed

+2321
-900
lines changed

Some content is hidden

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

136 files changed

+2321
-900
lines changed

.github/workflows/atlas-ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ jobs:
4848
key: "extcache-v1"
4949

5050
- name: Cache extensions
51-
uses: actions/cache@v4
51+
uses: actions/cache@v5
5252
with:
5353
path: ${{ steps.extcache.outputs.dir }}
5454
key: ${{ steps.extcache.outputs.key }}

.github/workflows/continuous-integration.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ jobs:
8686
key: "extcache-v1"
8787

8888
- name: Cache extensions
89-
uses: actions/cache@v4
89+
uses: actions/cache@v5
9090
with:
9191
path: ${{ steps.extcache.outputs.dir }}
9292
key: ${{ steps.extcache.outputs.key }}

.github/workflows/performance.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
key: "extcache-v1"
3838

3939
- name: Cache extensions
40-
uses: actions/cache@v4
40+
uses: actions/cache@v5
4141
with:
4242
path: ${{ steps.extcache.outputs.dir }}
4343
key: ${{ steps.extcache.outputs.key }}
@@ -57,7 +57,7 @@ jobs:
5757
uses: "ramsey/composer-install@v3"
5858

5959
- name: "Upload composer.lock as build artifact"
60-
uses: actions/upload-artifact@v5
60+
uses: actions/upload-artifact@v6
6161
with:
6262
name: composer.lock-${{ matrix.php-version }}
6363
path: composer.lock

.github/workflows/static-analysis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
key: "extcache-v1"
3232

3333
- name: Cache extensions
34-
uses: actions/cache@v4
34+
uses: actions/cache@v5
3535
with:
3636
path: ${{ steps.extcache.outputs.dir }}
3737
key: ${{ steps.extcache.outputs.key }}
@@ -51,7 +51,7 @@ jobs:
5151
uses: "ramsey/composer-install@v3"
5252

5353
- name: "Upload composer.lock as build artifact"
54-
uses: actions/upload-artifact@v5
54+
uses: actions/upload-artifact@v6
5555
with:
5656
name: "composer-lock-static-analysis-phpstan"
5757
path: composer.lock

UPGRADE-2.16.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,37 @@
11
# UPGRADE FROM 2.15 to 2.16
22

3+
## Attribute namespaces
4+
5+
Doctrine annotations are already deprecated in favor of PHP attributes.
6+
As of MongoDB ODM 2.16, the namespace of attribute classes has been changed from
7+
`Doctrine\ODM\MongoDB\Mapping\Annotations` to `Doctrine\ODM\MongoDB\Mapping\Attribute`.
8+
The old classes continue to work, but they are deprecated and will be removed in 3.0.
9+
10+
```diff
11+
- use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM;
12+
+ use Doctrine\ODM\MongoDB\Mapping\Attribute as ODM;
13+
14+
#[ODM\Document]
15+
class User
16+
{
17+
#[ODM\Id]
18+
private string $id;
19+
20+
#[ODM\Field]
21+
public string $name;
22+
}
23+
```
24+
25+
The enum `Doctrine\ODM\MongoDB\Mapping\Annotations\EncryptQuery` has been moved to
26+
`Doctrine\ODM\MongoDB\Mapping\Attribute\EncryptQuery`.
27+
28+
[BC break] The classes `Doctrine\ODM\MongoDB\Mapping\Annotations\AbstractDocument`,
29+
`AbstractField` and `AbstractIndex` does not implement
30+
`Doctrine\ODM\MongoDB\Mapping\Annotations\Annotation` anymore;
31+
they must not be used outside the `doctrine/mongodb-odm` package.
32+
The new abstract classes in the `Doctrine\ODM\MongoDB\Mapping\Attribute`
33+
are marked as `@internal`.
34+
335
## Package `doctrine/cache` no longer required
436

537
If you use `Doctrine\ODM\MongoDB\Configuration::getMetadataCacheImpl()`,

docs/en/cookbook/mapping-classes-to-orm-and-odm.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ Now map the same class to the Doctrine MongoDB ODM:
113113
namespace Documents\Blog;
114114
115115
use Documents\Blog\Repository\ODM\BlogPostRepository;
116-
use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM;
116+
use Doctrine\ODM\MongoDB\Mapping\Attribute as ODM;
117117
118118
#[ODM\Document(repositoryClass: BlogPostRepository::class)]
119119
class BlogPost

docs/en/cookbook/queryable-encryption.rst

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,8 @@ fields that require encryption.
4747
4848
namespace Documents;
4949
50-
use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM;
51-
use Doctrine\ODM\MongoDB\Mapping\Annotations\Encrypt;
52-
use Doctrine\ODM\MongoDB\Mapping\Annotations\EncryptQuery;
50+
use Doctrine\ODM\MongoDB\Mapping\Attribute as ODM;
51+
use Doctrine\ODM\MongoDB\Mapping\EncryptQuery;
5352
5453
#[ODM\Document]
5554
class Patient
@@ -69,15 +68,15 @@ fields that require encryption.
6968
* This allows us to find a patient by their exact SSN.
7069
*/
7170
#[ODM\Field(type: 'string')]
72-
#[Encrypt(queryType: EncryptQuery::Equality)]
71+
#[ODM\Encrypt(queryType: EncryptQuery::Equality)]
7372
public string $ssn;
7473
7574
/**
7675
* The entire embedded document is encrypted as an object.
7776
* By not specifying a queryType, we make it non-queryable.
7877
*/
7978
#[ODM\EmbedOne(targetDocument: Billing::class)]
80-
#[Encrypt]
79+
#[ODM\Encrypt]
8180
public Billing $billing;
8281
8382
/**

docs/en/cookbook/time-series-data.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ First, we define the model for our data:
4747
<?php
4848
4949
use DateTimeImmutable;
50-
use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM;
50+
use Doctrine\ODM\MongoDB\Mapping\Attribute as ODM;
5151
use MongoDB\BSON\ObjectId;
5252
5353
#[ODM\Document]

docs/en/cookbook/validation-of-documents.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ the ``odm:schema:create`` or ``odm:schema:update`` command.
175175
176176
namespace Documents;
177177
178-
use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM;
178+
use Doctrine\ODM\MongoDB\Mapping\Attribute as ODM;
179179
use Doctrine\ODM\MongoDB\Mapping\ClassMetadata;
180180
181181
#[ODM\Document]

docs/en/cookbook/vector-search.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ return the same result because Voyage AI uses normalized vectors to length 1.
3636

3737
.. code-block:: php
3838
39-
use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM;
39+
use Doctrine\ODM\MongoDB\Mapping\Attribute as ODM;
4040
use Doctrine\ODM\MongoDB\Mapping\ClassMetadata;
4141
use Doctrine\ODM\MongoDB\Types\Type;
4242
use Symfony\AI\Platform\Vector\Vector;

0 commit comments

Comments
 (0)