Skip to content

Commit db4d00a

Browse files
committed
Merge remote-tracking branch 'origin/2.18.x' into 3.0.x
2 parents 1a5942a + 5b5b56d commit db4d00a

21 files changed

+179
-145
lines changed

.github/workflows/coding-standards.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88
- .github/workflows/coding-standards.yml
99
- bin/**
1010
- composer.*
11-
- lib/**
11+
- src/**
1212
- phpcs.xml.dist
1313
- tests/**
1414
push:
@@ -18,7 +18,7 @@ on:
1818
- .github/workflows/coding-standards.yml
1919
- bin/**
2020
- composer.*
21-
- lib/**
21+
- src/**
2222
- phpcs.xml.dist
2323
- tests/**
2424

.github/workflows/continuous-integration.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88
- .github/workflows/continuous-integration.yml
99
- ci/**
1010
- composer.*
11-
- lib/**
11+
- src/**
1212
- phpunit.xml.dist
1313
- tests/**
1414
push:
@@ -18,7 +18,7 @@ on:
1818
- .github/workflows/continuous-integration.yml
1919
- ci/**
2020
- composer.*
21-
- lib/**
21+
- src/**
2222
- phpunit.xml.dist
2323
- tests/**
2424

.github/workflows/phpbench.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88
paths:
99
- .github/workflows/phpbench.yml
1010
- composer.*
11-
- lib/**
11+
- src/**
1212
- phpbench.json
1313
- tests/**
1414
push:
@@ -17,7 +17,7 @@ on:
1717
paths:
1818
- .github/workflows/phpbench.yml
1919
- composer.*
20-
- lib/**
20+
- src/**
2121
- phpbench.json
2222
- tests/**
2323

.github/workflows/static-analysis.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
paths:
88
- .github/workflows/static-analysis.yml
99
- composer.*
10-
- lib/**
10+
- src/**
1111
- phpstan*
1212
- psalm*
1313
- tests/Doctrine/StaticAnalysis/**
@@ -17,7 +17,7 @@ on:
1717
paths:
1818
- .github/workflows/static-analysis.yml
1919
- composer.*
20-
- lib/**
20+
- src/**
2121
- phpstan*
2222
- psalm*
2323
- tests/Doctrine/StaticAnalysis/**

.gitignore

-3
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@ logs/
33
reports/
44
dist/
55
download/
6-
lib/api/
7-
lib/Doctrine/Common
8-
lib/Doctrine/DBAL
96
/.settings/
107
.buildpath
118
.project

.gitmodules

-6
This file was deleted.

README.md

+11-11
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
| [3.0.x][3.0] | [2.16.x][2.16] | [2.15.x][2.15] |
1+
| [3.0.x][3.0] | [2.18.x][2.18] | [2.17.x][2.17] |
22
|:----------------:|:----------------:|:----------:|
3-
| [![Build status][3.0 image]][3.0] | [![Build status][2.16 image]][2.16] | [![Build status][2.15 image]][2.15] |
4-
| [![Coverage Status][3.0 coverage image]][3.0 coverage]| [![Coverage Status][2.16 coverage image]][2.16 coverage] | [![Coverage Status][2.15 coverage image]][2.15 coverage] |
3+
| [![Build status][3.0 image]][3.0] | [![Build status][2.18 image]][2.18] | [![Build status][2.17 image]][2.17] |
4+
| [![Coverage Status][3.0 coverage image]][3.0 coverage]| [![Coverage Status][2.18 coverage image]][2.18 coverage] | [![Coverage Status][2.17 coverage image]][2.17 coverage] |
55

66
[<h1 align="center">🇺🇦 UKRAINE NEEDS YOUR HELP NOW!</h1>](https://www.doctrine-project.org/stop-war.html)
77

@@ -22,11 +22,11 @@ without requiring unnecessary code duplication.
2222
[3.0]: https://github.com/doctrine/orm/tree/3.0.x
2323
[3.0 coverage image]: https://codecov.io/gh/doctrine/orm/branch/3.0.x/graph/badge.svg
2424
[3.0 coverage]: https://codecov.io/gh/doctrine/orm/branch/3.0.x
25-
[2.16 image]: https://github.com/doctrine/orm/actions/workflows/continuous-integration.yml/badge.svg?branch=2.16.x
26-
[2.16]: https://github.com/doctrine/orm/tree/2.16.x
27-
[2.16 coverage image]: https://codecov.io/gh/doctrine/orm/branch/2.16.x/graph/badge.svg
28-
[2.16 coverage]: https://codecov.io/gh/doctrine/orm/branch/2.16.x
29-
[2.15 image]: https://github.com/doctrine/orm/actions/workflows/continuous-integration.yml/badge.svg?branch=2.15.x
30-
[2.15]: https://github.com/doctrine/orm/tree/2.15.x
31-
[2.15 coverage image]: https://codecov.io/gh/doctrine/orm/branch/2.15.x/graph/badge.svg
32-
[2.15 coverage]: https://codecov.io/gh/doctrine/orm/branch/2.15.x
25+
[2.18 image]: https://github.com/doctrine/orm/actions/workflows/continuous-integration.yml/badge.svg?branch=2.18.x
26+
[2.18]: https://github.com/doctrine/orm/tree/2.18.x
27+
[2.18 coverage image]: https://codecov.io/gh/doctrine/orm/branch/2.18.x/graph/badge.svg
28+
[2.18 coverage]: https://codecov.io/gh/doctrine/orm/branch/2.18.x
29+
[2.17 image]: https://github.com/doctrine/orm/actions/workflows/continuous-integration.yml/badge.svg?branch=2.17.x
30+
[2.17]: https://github.com/doctrine/orm/tree/2.17.x
31+
[2.17 coverage image]: https://codecov.io/gh/doctrine/orm/branch/2.17.x/graph/badge.svg
32+
[2.17 coverage]: https://codecov.io/gh/doctrine/orm/branch/2.17.x

SECURITY.md

+2-3
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,5 @@ understand the assumptions we make.
1313
- [DBAL Security Page](https://www.doctrine-project.org/projects/doctrine-dbal/en/stable/reference/security.html)
1414
- [ORM Security Page](https://www.doctrine-project.org/projects/doctrine-orm/en/stable/reference/security.html)
1515

16-
If you find a Security bug in Doctrine, please report it on Jira and change the
17-
Security Level to "Security Issues". It will be visible to Doctrine Core
18-
developers and you only.
16+
If you find a Security bug in Doctrine, please follow our
17+
[Security reporting guidelines](https://www.doctrine-project.org/policies/security.html#reporting).

docs/en/cookbook/aggregate-fields.rst

+50-77
Original file line numberDiff line numberDiff line change
@@ -36,71 +36,50 @@ Our entities look like:
3636
namespace Bank\Entities;
3737
3838
use Doctrine\ORM\Mapping as ORM;
39-
40-
/**
41-
* @ORM\Entity
42-
*/
39+
use Doctrine\Common\Collections\ArrayCollection;
40+
use Doctrine\Common\Collections\Collection;
41+
42+
#[ORM\Entity]
4343
class Account
4444
{
45-
/**
46-
* @ORM\Id
47-
* @ORM\GeneratedValue
48-
* @ORM\Column(type="integer")
49-
*/
45+
#[ORM\Id]
46+
#[ORM\GeneratedValue]
47+
#[ORM\Column(type: 'integer')]
5048
private ?int $id;
51-
52-
/**
53-
* @ORM\Column(type="string", unique=true)
54-
*/
55-
private string $no;
56-
57-
/**
58-
* @ORM\OneToMany(targetEntity="Entry", mappedBy="account", cascade={"persist"})
59-
*/
60-
private array $entries;
61-
62-
/**
63-
* @ORM\Column(type="integer")
64-
*/
65-
private int $maxCredit = 0;
66-
67-
public function __construct(string $no, int $maxCredit = 0)
68-
{
69-
$this->no = $no;
70-
$this->maxCredit = $maxCredit;
71-
$this->entries = new \Doctrine\Common\Collections\ArrayCollection();
49+
50+
#[ORM\OneToMany(targetEntity: Entry::class, mappedBy: 'account', cascade: ['persist'])]
51+
private Collection $entries;
52+
53+
54+
public function __construct(
55+
#[ORM\Column(type: 'string', unique: true)]
56+
private string $no,
57+
58+
#[ORM\Column(type: 'integer')]
59+
private int $maxCredit = 0,
60+
) {
61+
$this->entries = new ArrayCollection();
7262
}
7363
}
74-
75-
/**
76-
* @ORM\Entity
77-
*/
64+
65+
#[ORM\Entity]
7866
class Entry
7967
{
80-
/**
81-
* @ORM\Id
82-
* @ORM\GeneratedValue
83-
* @ORM\Column(type="integer")
84-
*/
68+
#[ORM\Id]
69+
#[ORM\GeneratedValue]
70+
#[ORM\Column(type: 'integer')]
8571
private ?int $id;
86-
87-
/**
88-
* @ORM\ManyToOne(targetEntity="Account", inversedBy="entries")
89-
*/
90-
private Account $account;
91-
92-
/**
93-
* @ORM\Column(type="integer")
94-
*/
95-
private int $amount;
96-
97-
public function __construct(Account $account, int $amount)
98-
{
99-
$this->account = $account;
100-
$this->amount = $amount;
72+
73+
public function __construct(
74+
#[ORM\ManyToOne(targetEntity: Account::class, inversedBy: 'entries')]
75+
private Account $account,
76+
77+
#[ORM\Column(type: 'integer')]
78+
private int $amount,
79+
) {
10180
// more stuff here, from/to whom, stated reason, execution date and such
10281
}
103-
82+
10483
public function getAmount(): Amount
10584
{
10685
return $this->amount;
@@ -193,9 +172,8 @@ relation with this method:
193172
public function addEntry(int $amount): void
194173
{
195174
$this->assertAcceptEntryAllowed($amount);
196-
197-
$e = new Entry($this, $amount);
198-
$this->entries[] = $e;
175+
176+
$this->entries[] = new Entry($this, $amount);
199177
}
200178
}
201179
@@ -213,18 +191,18 @@ Now look at the following test-code for our entities:
213191
{
214192
$account = new Account("123456", maxCredit: 200);
215193
$this->assertEquals(0, $account->getBalance());
216-
194+
217195
$account->addEntry(500);
218196
$this->assertEquals(500, $account->getBalance());
219-
197+
220198
$account->addEntry(-700);
221199
$this->assertEquals(-200, $account->getBalance());
222200
}
223-
201+
224202
public function testExceedMaxLimit()
225203
{
226204
$account = new Account("123456", maxCredit: 200);
227-
205+
228206
$this->expectException(Exception::class);
229207
$account->addEntry(-1000);
230208
}
@@ -285,22 +263,19 @@ entries collection) we want to add an aggregate field called
285263
<?php
286264
class Account
287265
{
288-
/**
289-
* @ORM\Column(type="integer")
290-
*/
266+
#[ORM\Column(type: 'integer')]
291267
private int $balance = 0;
292-
268+
293269
public function getBalance(): int
294270
{
295271
return $this->balance;
296272
}
297-
273+
298274
public function addEntry(int $amount): void
299275
{
300276
$this->assertAcceptEntryAllowed($amount);
301-
302-
$e = new Entry($this, $amount);
303-
$this->entries[] = $e;
277+
278+
$this->entries[] = new Entry($this, $amount);
304279
$this->balance += $amount;
305280
}
306281
}
@@ -331,13 +306,13 @@ potentially lead to inconsistent state. See this example:
331306
// The Account $accId has a balance of 0 and a max credit limit of 200:
332307
// request 1 account
333308
$account1 = $em->find(Account::class, $accId);
334-
309+
335310
// request 2 account
336311
$account2 = $em->find(Account::class, $accId);
337-
312+
338313
$account1->addEntry(-200);
339314
$account2->addEntry(-200);
340-
315+
341316
// now request 1 and 2 both flush the changes.
342317
343318
The aggregate field ``Account::$balance`` is now -200, however the
@@ -357,10 +332,8 @@ Optimistic locking is as easy as adding a version column:
357332
358333
class Account
359334
{
360-
/**
361-
* @ORM\Column(type="integer")
362-
* @ORM\Version
363-
*/
335+
#[ORM\Column(type: 'integer')]
336+
#[ORM\Version]
364337
private int $version;
365338
}
366339

docs/en/cookbook/resolve-target-entity-listener.rst

+6-15
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,8 @@ A Customer entity
4747
use Acme\CustomerModule\Entity\Customer as BaseCustomer;
4848
use Acme\InvoiceModule\Model\InvoiceSubjectInterface;
4949
50-
/**
51-
* @ORM\Entity
52-
* @ORM\Table(name="customer")
53-
*/
50+
#[ORM\Entity]
51+
#[ORM\Table(name: 'customer')]
5452
class Customer extends BaseCustomer implements InvoiceSubjectInterface
5553
{
5654
// In our example, any methods defined in the InvoiceSubjectInterface
@@ -69,19 +67,12 @@ An Invoice entity
6967
use Doctrine\ORM\Mapping AS ORM;
7068
use Acme\InvoiceModule\Model\InvoiceSubjectInterface;
7169
72-
/**
73-
* Represents an Invoice.
74-
*
75-
* @ORM\Entity
76-
* @ORM\Table(name="invoice")
77-
*/
70+
#[ORM\Entity]
71+
#[ORM\Table(name: 'invoice')]
7872
class Invoice
7973
{
80-
/**
81-
* @ORM\ManyToOne(targetEntity="Acme\InvoiceModule\Model\InvoiceSubjectInterface")
82-
* @var InvoiceSubjectInterface
83-
*/
84-
protected $subject;
74+
#[ORM\ManyToOne(targetEntity: InvoiceSubjectInterface::class)]
75+
protected InvoiceSubjectInterface $subject;
8576
}
8677
8778
An InvoiceSubjectInterface

docs/en/reference/security.rst

+2-3
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,8 @@ page only handles Security issues in the ORM.
1212

1313
- `DBAL Security Page <https://www.doctrine-project.org/projects/doctrine-dbal/en/current/reference/security.html>`
1414

15-
If you find a Security bug in Doctrine, please report it on Jira and change the
16-
Security Level to "Security Issues". It will be visible to Doctrine Core
17-
developers and you only.
15+
If you find a Security bug in Doctrine, please follow our
16+
`Security reporting guidelines <https://www.doctrine-project.org/policies/security.html#reporting>`_.
1817

1918
User input and Doctrine ORM
2019
---------------------------

phpstan-dbal3.neon

-3
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,3 @@ parameters:
3131
message: '#Negated boolean expression is always false\.#'
3232
paths:
3333
- src/Mapping/Driver/AttributeDriver.php
34-
- src/Mapping/Driver/SimplifiedXmlDriver.php
35-
- src/Mapping/Driver/XmlDriver.php
36-
- src/ORMSetup.php

phpstan.neon

-3
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,3 @@ parameters:
4949
message: '#Negated boolean expression is always false\.#'
5050
paths:
5151
- src/Mapping/Driver/AttributeDriver.php
52-
- src/Mapping/Driver/SimplifiedXmlDriver.php
53-
- src/Mapping/Driver/XmlDriver.php
54-
- src/ORMSetup.php

0 commit comments

Comments
 (0)