Skip to content

Commit 03148b1

Browse files
authored
Merge pull request doctrine#10964 from soltmar/2.16.x-update-order-of-mapping-attributes
Updated order of mapping attribute parameters
2 parents 06eb00d + f47d68c commit 03148b1

File tree

4 files changed

+8
-3
lines changed

4 files changed

+8
-3
lines changed

UPGRADE.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Upgrade to 3.0
22

3+
## Minor BC BREAK: Changed order of arguments passed to `OneToOne`, `ManyToOne` and `Index` mapping PHP attributes
4+
5+
To keep PHP mapping attributes consistent, order of arguments passed to above attributes has been changed
6+
so `$targetEntity` is a first argument now. This change affects only non-named arguments usage.
7+
38
## BC BREAK: AUTO keyword for identity generation defaults to IDENTITY for PostgreSQL now
49

510
When using the AUTO strategy to let Doctrine determine the identity generation mecehanism for

lib/Doctrine/ORM/Mapping/Index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ final class Index implements MappingAttribute
1616
* @param array<string,mixed>|null $options
1717
*/
1818
public function __construct(
19+
public readonly string|null $name = null,
1920
public readonly array|null $columns = null,
2021
public readonly array|null $fields = null,
21-
public readonly string|null $name = null,
2222
public readonly array|null $flags = null,
2323
public readonly array|null $options = null,
2424
) {

lib/Doctrine/ORM/Mapping/OneToMany.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ final class OneToMany implements MappingAttribute
1515
* @psalm-param 'LAZY'|'EAGER'|'EXTRA_LAZY' $fetch
1616
*/
1717
public function __construct(
18-
public readonly string|null $mappedBy = null,
1918
public readonly string|null $targetEntity = null,
19+
public readonly string|null $mappedBy = null,
2020
public readonly array|null $cascade = null,
2121
public readonly string $fetch = 'LAZY',
2222
public readonly bool $orphanRemoval = false,

lib/Doctrine/ORM/Mapping/OneToOne.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ final class OneToOne implements MappingAttribute
1515
* @psalm-param 'LAZY'|'EAGER'|'EXTRA_LAZY' $fetch
1616
*/
1717
public function __construct(
18+
public readonly string|null $targetEntity = null,
1819
public readonly string|null $mappedBy = null,
1920
public readonly string|null $inversedBy = null,
20-
public readonly string|null $targetEntity = null,
2121
public readonly array|null $cascade = null,
2222
public readonly string $fetch = 'LAZY',
2323
public readonly bool $orphanRemoval = false,

0 commit comments

Comments
 (0)