Skip to content

Commit 91fc597

Browse files
authored
Merge pull request #2964 from GromNaN/merge-2.16-into-3.0
Merge 2.16.x into 3.0.x
2 parents a1d6e5e + 6159161 commit 91fc597

File tree

7 files changed

+41
-20
lines changed

7 files changed

+41
-20
lines changed

.github/workflows/performance.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,4 +63,4 @@ jobs:
6363
path: composer.lock
6464

6565
- name: "Run PHPBench"
66-
run: "vendor/bin/phpbench run --report=default --revs=100 --iterations=5 --report=aggregate"
66+
run: "vendor/bin/phpbench run --report=default --report=aggregate"

.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@13.0.0"
21+
uses: "doctrine/.github/.github/workflows/website-schema.yml@13.1.0"

UPGRADE-2.16.md

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

3+
## Package `doctrine/cache` no longer required
4+
5+
If you use `Doctrine\ODM\MongoDB\Configuration::getMetadataCacheImpl()`,
6+
then you need to require `doctrine/cache` explicitly in `composer.json`;
7+
or use `Doctrine\ODM\MongoDB\Configuration::getMetadataCache()` instead.
8+
39
## Lazy Proxy Directory
410

511
Using proxy classes with PHP 8.4+ is deprecated, only native lazy objects will

benchmark/BaseBench.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,10 @@ public function initDocumentManager(): void
3232
{
3333
$config = new Configuration();
3434

35-
$config->setHydratorDir(__DIR__ . '/../../tests/Hydrators');
35+
$config->setHydratorDir(__DIR__ . '/../tests/Hydrators');
36+
$config->setAutoGenerateHydratorClasses(Configuration::AUTOGENERATE_ALWAYS);
3637
$config->setHydratorNamespace('Hydrators');
37-
$config->setPersistentCollectionDir(__DIR__ . '/../../tests/PersistentCollections');
38+
$config->setPersistentCollectionDir(__DIR__ . '/../tests/PersistentCollections');
3839
$config->setPersistentCollectionNamespace('PersistentCollections');
3940
$config->setDefaultDB(self::DATABASE_NAME);
4041
$config->setMetadataDriverImpl(self::createMetadataDriverImpl());

benchmark/Document/HydrateDocumentBench.php

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,22 @@
1010
use MongoDB\BSON\ObjectId;
1111
use MongoDB\BSON\UTCDateTime;
1212
use PhpBench\Attributes\BeforeMethods;
13+
use PhpBench\Attributes\Iterations;
14+
use PhpBench\Attributes\Revs;
1315
use PhpBench\Attributes\Warmup;
1416

1517
#[BeforeMethods(['initDocumentManager', 'clearDatabase', 'init'])]
18+
#[Warmup(2)]
19+
#[Revs(100)]
20+
#[Iterations(5)]
1621
final class HydrateDocumentBench extends BaseBench
1722
{
1823
/** @var array<string, mixed> */
1924
private static array $data;
2025

26+
/** @var array<string, mixed> */
27+
private static array $extraData;
28+
2129
/** @var array<string, mixed> */
2230
private static array $embedOneData;
2331

@@ -40,6 +48,17 @@ public function init(): void
4048
'createdAt' => new UTCDateTime(),
4149
];
4250

51+
self::$extraData = [
52+
'hits' => 100,
53+
'age' => 30,
54+
'nullTest' => null,
55+
'logs' => [
56+
'User logged in',
57+
'User updated profile',
58+
'User logged out',
59+
],
60+
];
61+
4362
self::$embedOneData = [
4463
'address' => ['city' => 'Munich'],
4564
];
@@ -77,31 +96,26 @@ public function init(): void
7796
->getHydratorFor(User::class);
7897
}
7998

80-
#[Warmup(2)]
8199
public function benchHydrateDocument(): void
82100
{
83-
self::$hydrator->hydrate(new User(), self::$data);
101+
self::$hydrator->hydrate(new User(), self::$data + self::$extraData);
84102
}
85103

86-
#[Warmup(2)]
87104
public function benchHydrateDocumentWithEmbedOne(): void
88105
{
89106
self::$hydrator->hydrate(new User(), self::$data + self::$embedOneData);
90107
}
91108

92-
#[Warmup(2)]
93109
public function benchHydrateDocumentWithEmbedMany(): void
94110
{
95111
self::$hydrator->hydrate(new User(), self::$data + self::$embedManyData);
96112
}
97113

98-
#[Warmup(2)]
99114
public function benchHydrateDocumentWithReferenceOne(): void
100115
{
101116
self::$hydrator->hydrate(new User(), self::$data + self::$referenceOneData);
102117
}
103118

104-
#[Warmup(2)]
105119
public function benchHydrateDocumentWithReferenceMany(): void
106120
{
107121
self::$hydrator->hydrate(new User(), self::$data + self::$referenceManyData);

benchmark/Document/LoadDocumentBench.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,16 @@
1313
use Documents\User;
1414
use MongoDB\BSON\ObjectId;
1515
use PhpBench\Attributes\BeforeMethods;
16+
use PhpBench\Attributes\Iterations;
17+
use PhpBench\Attributes\Revs;
1618
use PhpBench\Attributes\Warmup;
1719

1820
use function assert;
1921

2022
#[BeforeMethods(['initDocumentManager', 'clearDatabase', 'init'])]
23+
#[Warmup(2)]
24+
#[Revs(100)]
25+
#[Iterations(5)]
2126
final class LoadDocumentBench extends BaseBench
2227
{
2328
private static ObjectId $userId;
@@ -52,33 +57,28 @@ public function init(): void
5257
$this->getDocumentManager()->clear();
5358
}
5459

55-
#[Warmup(2)]
5660
public function benchLoadDocument(): void
5761
{
5862
$this->loadDocument();
5963
}
6064

61-
#[Warmup(2)]
6265
public function benchLoadEmbedOne(): void
6366
{
6467
$this->loadDocument()->getAddress()->getCity();
6568
}
6669

67-
#[Warmup(2)]
6870
public function benchLoadEmbedMany(): void
6971
{
7072
$this->loadDocument()->getPhonenumbers()->forAll(static function (int $key, Phonenumber $element) {
7173
return $element->getPhoneNumber() !== null;
7274
});
7375
}
7476

75-
#[Warmup(2)]
7677
public function benchLoadReferenceOne(): void
7778
{
7879
$this->loadDocument()->getAccount()->getName();
7980
}
8081

81-
#[Warmup(2)]
8282
public function benchLoadReferenceMany(): void
8383
{
8484
$this->loadDocument()->getGroups()->forAll(static function (int $key, Group $group) {

benchmark/Document/StoreDocumentBench.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,16 @@
1212
use Documents\Phonenumber;
1313
use Documents\User;
1414
use PhpBench\Attributes\BeforeMethods;
15+
use PhpBench\Attributes\Iterations;
16+
use PhpBench\Attributes\Revs;
1517
use PhpBench\Attributes\Warmup;
1618

1719
#[BeforeMethods(['initDocumentManager', 'clearDatabase'])]
20+
#[Warmup(2)]
21+
#[Revs(100)]
22+
#[Iterations(5)]
1823
final class StoreDocumentBench extends BaseBench
1924
{
20-
#[Warmup(2)]
2125
public function benchStoreDocument(): void
2226
{
2327
$user = new User();
@@ -29,7 +33,6 @@ public function benchStoreDocument(): void
2933
$this->getDocumentManager()->clear();
3034
}
3135

32-
#[Warmup(2)]
3336
public function benchStoreDocumentWithEmbedOne(): void
3437
{
3538
$address = new Address();
@@ -46,7 +49,6 @@ public function benchStoreDocumentWithEmbedOne(): void
4649
$this->getDocumentManager()->clear();
4750
}
4851

49-
#[Warmup(2)]
5052
public function benchStoreDocumentWithEmbedMany(): void
5153
{
5254
$user = new User();
@@ -60,7 +62,6 @@ public function benchStoreDocumentWithEmbedMany(): void
6062
$this->getDocumentManager()->clear();
6163
}
6264

63-
#[Warmup(2)]
6465
public function benchStoreDocumentWithReferenceOne(): void
6566
{
6667
$account = new Account();
@@ -76,7 +77,6 @@ public function benchStoreDocumentWithReferenceOne(): void
7677
$this->getDocumentManager()->clear();
7778
}
7879

79-
#[Warmup(2)]
8080
public function benchStoreDocumentWithReferenceMany(): void
8181
{
8282
$group1 = new Group('One');

0 commit comments

Comments
 (0)