Skip to content

Commit e7665c8

Browse files
committed
Deprecate SequenceGenerator implementing Serializable
1 parent 0a177d5 commit e7665c8

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

UPGRADE.md

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

3+
## Deprecate remaining `Serializable` implementation
4+
5+
Relying on `SequenceGenerator` implementing the `Serializable` is deprecated
6+
because that interface won't be implemented in ORM 4 anymore.
7+
8+
The following methods are deprecated:
9+
10+
* `SequenceGenerator::serialize()`
11+
* `SequenceGenerator::unserialize()`
12+
313
## `orm:schema-tool:update` option `--complete` is deprecated
414

515
That option behaves as a no-op, and is deprecated. It will be removed in 4.0.

src/Id/SequenceGenerator.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
namespace Doctrine\ORM\Id;
66

77
use Doctrine\DBAL\Connections\PrimaryReadReplicaConnection;
8+
use Doctrine\Deprecations\Deprecation;
89
use Doctrine\ORM\EntityManagerInterface;
910
use Serializable;
1011

@@ -65,8 +66,17 @@ public function getNextValue(): int
6566
return $this->nextValue;
6667
}
6768

69+
/** @deprecated without replacement. */
6870
final public function serialize(): string
6971
{
72+
Deprecation::trigger(
73+
'doctrine/orm',
74+
'https://github.com/doctrine/orm/pull/11468',
75+
'%s() is deprecated, use __serialize() instead. %s won\'t implement the Serializable interface anymore in ORM 4.',
76+
__METHOD__,
77+
self::class,
78+
);
79+
7080
return serialize($this->__serialize());
7181
}
7282

@@ -79,8 +89,17 @@ public function __serialize(): array
7989
];
8090
}
8191

92+
/** @deprecated without replacement. */
8293
final public function unserialize(string $serialized): void
8394
{
95+
Deprecation::trigger(
96+
'doctrine/orm',
97+
'https://github.com/doctrine/orm/pull/11468',
98+
'%s() is deprecated, use __unserialize() instead. %s won\'t implement the Serializable interface anymore in ORM 4.',
99+
__METHOD__,
100+
self::class,
101+
);
102+
84103
$this->__unserialize(unserialize($serialized));
85104
}
86105

0 commit comments

Comments
 (0)