Skip to content

Commit

Permalink
Remove Serializable implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
derrabus committed May 22, 2024
1 parent f4bbf8e commit 59e949d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 34 deletions.
9 changes: 9 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Upgrade to 4.0

## Remove remaining `Serializable` implementation

`SequenceGenerator` does not implement the `Serializable` interface anymore.

The following methods have been removed:

* `SequenceGenerator::serialize()`
* `SequenceGenerator::unserialize()`

## Remove `orm:schema-tool:update` option `--complete`

That option was a no-op.
Expand Down
35 changes: 1 addition & 34 deletions src/Id/SequenceGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,12 @@
namespace Doctrine\ORM\Id;

use Doctrine\DBAL\Connections\PrimaryReadReplicaConnection;
use Doctrine\Deprecations\Deprecation;
use Doctrine\ORM\EntityManagerInterface;
use Serializable;

use function serialize;
use function unserialize;

/**
* Represents an ID generator that uses a database sequence.
*/
class SequenceGenerator extends AbstractIdGenerator implements Serializable
class SequenceGenerator extends AbstractIdGenerator
{
private int $nextValue = 0;
private int|null $maxValue = null;
Expand Down Expand Up @@ -66,20 +61,6 @@ public function getNextValue(): int
return $this->nextValue;
}

/** @deprecated without replacement. */
final public function serialize(): string
{
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/pull/11468',
'%s() is deprecated, use __serialize() instead. %s won\'t implement the Serializable interface anymore in ORM 4.',
__METHOD__,
self::class,
);

return serialize($this->__serialize());
}

/** @return array<string, mixed> */
public function __serialize(): array
{
Expand All @@ -89,20 +70,6 @@ public function __serialize(): array
];
}

/** @deprecated without replacement. */
final public function unserialize(string $serialized): void
{
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/pull/11468',
'%s() is deprecated, use __unserialize() instead. %s won\'t implement the Serializable interface anymore in ORM 4.',
__METHOD__,
self::class,
);

$this->__unserialize(unserialize($serialized));
}

/** @param array<string, mixed> $data */
public function __unserialize(array $data): void
{
Expand Down

0 comments on commit 59e949d

Please sign in to comment.