Skip to content

Commit a93d7d2

Browse files
authored
Merge pull request doctrine#12092 from greg0ire/4.0.x
Merge 3.6.x up into 4.0.x
2 parents 224ff97 + 677e0a4 commit a93d7d2

File tree

20 files changed

+710
-122
lines changed

20 files changed

+710
-122
lines changed

.doctrine-project.json

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,39 +11,40 @@
1111
"slug": "latest",
1212
"upcoming": true
1313
},
14+
{
15+
"name": "3.6",
16+
"branchName": "3.6.x",
17+
"slug": "3.6",
18+
"upcoming": true
19+
},
1420
{
1521
"name": "3.5",
1622
"branchName": "3.5.x",
1723
"slug": "3.5",
18-
"upcoming": true
24+
"current": true
1925
},
2026
{
2127
"name": "3.4",
22-
"branchName": "3.4.x",
2328
"slug": "3.4",
24-
"current": true
29+
"maintained": false
2530
},
2631
{
2732
"name": "3.3",
28-
"branchName": "3.3.x",
2933
"slug": "3.3",
3034
"maintained": false
3135
},
3236
{
3337
"name": "3.2",
34-
"branchName": "3.2.x",
3538
"slug": "3.2",
3639
"maintained": false
3740
},
3841
{
3942
"name": "3.1",
40-
"branchName": "3.1.x",
4143
"slug": "3.1",
4244
"maintained": false
4345
},
4446
{
4547
"name": "3.0",
46-
"branchName": "3.0.x",
4748
"slug": "3.0",
4849
"maintained": false
4950
},
@@ -61,61 +62,51 @@
6162
},
6263
{
6364
"name": "2.19",
64-
"branchName": "2.19.x",
6565
"slug": "2.19",
6666
"maintained": false
6767
},
6868
{
6969
"name": "2.18",
70-
"branchName": "2.18.x",
7170
"slug": "2.18",
7271
"maintained": false
7372
},
7473
{
7574
"name": "2.17",
76-
"branchName": "2.17.x",
7775
"slug": "2.17",
7876
"maintained": false
7977
},
8078
{
8179
"name": "2.16",
82-
"branchName": "2.16.x",
8380
"slug": "2.16",
8481
"maintained": false
8582
},
8683
{
8784
"name": "2.15",
88-
"branchName": "2.15.x",
8985
"slug": "2.15",
9086
"maintained": false
9187
},
9288
{
9389
"name": "2.14",
94-
"branchName": "2.14.x",
9590
"slug": "2.14",
9691
"maintained": false
9792
},
9893
{
9994
"name": "2.13",
100-
"branchName": "2.13.x",
10195
"slug": "2.13",
10296
"maintained": false
10397
},
10498
{
10599
"name": "2.12",
106-
"branchName": "2.12.x",
107100
"slug": "2.12",
108101
"maintained": false
109102
},
110103
{
111104
"name": "2.11",
112-
"branchName": "2.11.x",
113105
"slug": "2.11",
114106
"maintained": false
115107
},
116108
{
117109
"name": "2.10",
118-
"branchName": "2.10.x",
119110
"slug": "2.10",
120111
"maintained": false
121112
}

.github/workflows/continuous-integration.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: "Continuous Integration"
1+
name: "CI"
22

33
on:
44
pull_request:

README.md

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
| [4.0.x][4.0] | [3.5.x][3.5] | [3.4.x][3.4] | [2.21.x][2.21] | [2.20.x][2.20] |
1+
| [4.0.x][4.0] | [3.6.x][3.6] | [3.5.x][3.5] | [2.21.x][2.21] | [2.20.x][2.20] |
22
|:------------------------------------------------------:|:------------------------------------------------------:|:------------------------------------------------------:|:--------------------------------------------------------:|:--------------------------------------------------------:|
3-
| [![Build status][4.0 image]][4.0] | [![Build status][3.5 image]][3.5] | [![Build status][3.4 image]][3.4] | [![Build status][2.21 image]][2.21] | [![Build status][2.20 image]][2.20] |
4-
| [![Coverage Status][4.0 coverage image]][4.0 coverage] | [![Coverage Status][3.5 coverage image]][3.5 coverage] | [![Coverage Status][3.4 coverage image]][3.4 coverage] | [![Coverage Status][2.21 coverage image]][2.21 coverage] | [![Coverage Status][2.20 coverage image]][2.20 coverage] |
3+
| [![Build status][4.0 image]][4.0 workflow] | [![Build status][3.6 image]][3.6 workflow] | [![Build status][3.5 image]][3.5 workflow] | [![Build status][2.21 image]][2.21 workflow] | [![Build status][2.20 image]][2.20 workflow] |
4+
| [![Coverage Status][4.0 coverage image]][4.0 coverage] | [![Coverage Status][3.6 coverage image]][3.6 coverage] | [![Coverage Status][3.5 coverage image]][3.5 coverage] | [![Coverage Status][2.21 coverage image]][2.21 coverage] | [![Coverage Status][2.20 coverage image]][2.20 coverage] |
55

66
Doctrine ORM is an object-relational mapper for PHP 8.1+ that provides transparent persistence
77
for PHP objects. It sits on top of a powerful database abstraction layer (DBAL). One of its key features
@@ -18,21 +18,26 @@ without requiring unnecessary code duplication.
1818

1919
[4.0 image]: https://github.com/doctrine/orm/actions/workflows/continuous-integration.yml/badge.svg?branch=4.0.x
2020
[4.0]: https://github.com/doctrine/orm/tree/4.0.x
21+
[4.0 workflow]: https://github.com/doctrine/orm/actions/workflows/continuous-integration.yml?query=branch%3A4.0.x
2122
[4.0 coverage image]: https://codecov.io/gh/doctrine/orm/branch/4.0.x/graph/badge.svg
2223
[4.0 coverage]: https://codecov.io/gh/doctrine/orm/branch/4.0.x
24+
[3.6 image]: https://github.com/doctrine/orm/actions/workflows/continuous-integration.yml/badge.svg?branch=3.6.x
25+
[3.6]: https://github.com/doctrine/orm/tree/3.6.x
26+
[3.6 workflow]: https://github.com/doctrine/orm/actions/workflows/continuous-integration.yml?query=branch%3A3.6.x
27+
[3.6 coverage image]: https://codecov.io/gh/doctrine/orm/branch/3.6.x/graph/badge.svg
28+
[3.6 coverage]: https://codecov.io/gh/doctrine/orm/branch/3.6.x
2329
[3.5 image]: https://github.com/doctrine/orm/actions/workflows/continuous-integration.yml/badge.svg?branch=3.5.x
2430
[3.5]: https://github.com/doctrine/orm/tree/3.5.x
31+
[3.5 workflow]: https://github.com/doctrine/orm/actions/workflows/continuous-integration.yml?query=branch%3A3.5.x
2532
[3.5 coverage image]: https://codecov.io/gh/doctrine/orm/branch/3.5.x/graph/badge.svg
2633
[3.5 coverage]: https://codecov.io/gh/doctrine/orm/branch/3.5.x
27-
[3.4 image]: https://github.com/doctrine/orm/actions/workflows/continuous-integration.yml/badge.svg?branch=3.4.x
28-
[3.4]: https://github.com/doctrine/orm/tree/3.4.x
29-
[3.4 coverage image]: https://codecov.io/gh/doctrine/orm/branch/3.4.x/graph/badge.svg
30-
[3.4 coverage]: https://codecov.io/gh/doctrine/orm/branch/3.4.x
3134
[2.21 image]: https://github.com/doctrine/orm/actions/workflows/continuous-integration.yml/badge.svg?branch=2.21.x
3235
[2.21]: https://github.com/doctrine/orm/tree/2.21.x
36+
[2.21 workflow]: https://github.com/doctrine/orm/actions/workflows/continuous-integration.yml?query=branch%3A2.21.x
3337
[2.21 coverage image]: https://codecov.io/gh/doctrine/orm/branch/2.21.x/graph/badge.svg
3438
[2.21 coverage]: https://codecov.io/gh/doctrine/orm/branch/2.21.x
3539
[2.20 image]: https://github.com/doctrine/orm/actions/workflows/continuous-integration.yml/badge.svg?branch=2.20.x
3640
[2.20]: https://github.com/doctrine/orm/tree/2.20.x
41+
[2.20 workflow]: https://github.com/doctrine/orm/actions/workflows/continuous-integration.yml?query=branch%3A2.20.x
3742
[2.20 coverage image]: https://codecov.io/gh/doctrine/orm/branch/2.20.x/graph/badge.svg
3843
[2.20 coverage]: https://codecov.io/gh/doctrine/orm/branch/2.20.x

UPGRADE.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,12 @@ The properties `$indexes` and `$uniqueConstraints` have been removed since they
118118
The preferred way of defining indices and unique constraints is by
119119
using the `\Doctrine\ORM\Mapping\UniqueConstraint` and `\Doctrine\ORM\Mapping\Index` attributes.
120120

121+
# Upgrade to 3.6
122+
123+
Using `Doctrine\ORM\QueryBuilder::add('join', ...)` with a list of join parts
124+
is deprecated in favor of using an associative array of join parts with the
125+
root alias as key.
126+
121127
# Upgrade to 3.5
122128

123129
## Deprecate not using native lazy objects on PHP 8.4+
@@ -189,6 +195,8 @@ that implements `ArrayAccess`.
189195
Use the new `Doctrine\ORM\Mapping\PropertyAccessors\PropertyAccessor` API and access
190196
through `Doctrine\ORM\Mapping\ClassMetadata::$propertyAccessors` instead.
191197

198+
Companion accessor methods are deprecated as well.
199+
192200
# Upgrade to 3.3
193201

194202
## Deprecate `DatabaseDriver`

docs/en/cookbook/mysql-enums.rst

Lines changed: 23 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -46,17 +46,18 @@ entities:
4646
#[Entity]
4747
class Article
4848
{
49-
const STATUS_VISIBLE = 'visible';
50-
const STATUS_INVISIBLE = 'invisible';
49+
public const STATUS_VISIBLE = 'visible';
50+
public const STATUS_INVISIBLE = 'invisible';
5151
5252
#[Column(type: "string")]
5353
private $status;
5454
55-
public function setStatus($status)
55+
public function setStatus(string $status): void
5656
{
57-
if (!in_array($status, array(self::STATUS_VISIBLE, self::STATUS_INVISIBLE))) {
57+
if (!in_array($status, [self::STATUS_VISIBLE, self::STATUS_INVISIBLE], true)) {
5858
throw new \InvalidArgumentException("Invalid status");
5959
}
60+
6061
$this->status = $status;
6162
}
6263
}
@@ -92,37 +93,33 @@ For example for the previous enum type:
9293
9394
class EnumVisibilityType extends Type
9495
{
95-
const ENUM_VISIBILITY = 'enumvisibility';
96-
const STATUS_VISIBLE = 'visible';
97-
const STATUS_INVISIBLE = 'invisible';
96+
private const ENUM_VISIBILITY = 'enumvisibility';
97+
private const STATUS_VISIBLE = 'visible';
98+
private const STATUS_INVISIBLE = 'invisible';
9899
99-
public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform)
100+
public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform): string
100101
{
101102
return "ENUM('visible', 'invisible')";
102103
}
103104
104-
public function convertToPHPValue($value, AbstractPlatform $platform)
105+
public function convertToPHPValue(mixed $value, AbstractPlatform $platform): mixed
105106
{
106107
return $value;
107108
}
108109
109-
public function convertToDatabaseValue($value, AbstractPlatform $platform)
110+
public function convertToDatabaseValue(mixed $value, AbstractPlatform $platform): string
110111
{
111-
if (!in_array($value, array(self::STATUS_VISIBLE, self::STATUS_INVISIBLE))) {
112+
if (!in_array($value, [self::STATUS_VISIBLE, self::STATUS_INVISIBLE], true)) {
112113
throw new \InvalidArgumentException("Invalid status");
113114
}
115+
114116
return $value;
115117
}
116118
117-
public function getName()
119+
public function getName(): string
118120
{
119121
return self::ENUM_VISIBILITY;
120122
}
121-
122-
public function requiresSQLCommentHint(AbstractPlatform $platform)
123-
{
124-
return true;
125-
}
126123
}
127124
128125
You can register this type with ``Type::addType('enumvisibility', 'MyProject\DBAL\EnumVisibilityType');``.
@@ -151,37 +148,33 @@ You can generalize this approach easily to create a base class for enums:
151148
abstract class EnumType extends Type
152149
{
153150
protected $name;
154-
protected $values = array();
151+
protected $values = [];
155152
156-
public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform)
153+
public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform): string
157154
{
158-
$values = array_map(function($val) { return "'".$val."'"; }, $this->values);
155+
$values = array_map(fn($val) => "'".$val."'", $this->values);
159156
160157
return "ENUM(".implode(", ", $values).")";
161158
}
162159
163-
public function convertToPHPValue($value, AbstractPlatform $platform)
160+
public function convertToPHPValue(mixed $value, AbstractPlatform $platform): mixed
164161
{
165162
return $value;
166163
}
167164
168-
public function convertToDatabaseValue($value, AbstractPlatform $platform)
165+
public function convertToDatabaseValue(mixed $value, AbstractPlatform $platform): mixed
169166
{
170-
if (!in_array($value, $this->values)) {
167+
if (!in_array($value, $this->values, true)) {
171168
throw new \InvalidArgumentException("Invalid '".$this->name."' value.");
172169
}
170+
173171
return $value;
174172
}
175173
176-
public function getName()
174+
public function getName(): string
177175
{
178176
return $this->name;
179177
}
180-
181-
public function requiresSQLCommentHint(AbstractPlatform $platform)
182-
{
183-
return true;
184-
}
185178
}
186179
187180
With this base class you can define an enum as easily as:
@@ -194,5 +187,5 @@ With this base class you can define an enum as easily as:
194187
class EnumVisibilityType extends EnumType
195188
{
196189
protected $name = 'enumvisibility';
197-
protected $values = array('visible', 'invisible');
190+
protected $values = ['visible', 'invisible'];
198191
}

0 commit comments

Comments
 (0)