Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate SequenceGenerator implementing Serializable #11468

Merged
merged 1 commit into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Upgrade to 3.2

## Deprecate remaining `Serializable` implementation

Relying on `SequenceGenerator` implementing the `Serializable` is deprecated
because that interface won't be implemented in ORM 4 anymore.

The following methods are deprecated:

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

## `orm:schema-tool:update` option `--complete` is deprecated

That option behaves as a no-op, and is deprecated. It will be removed in 4.0.
Expand Down
19 changes: 19 additions & 0 deletions src/Id/SequenceGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace Doctrine\ORM\Id;

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

Expand Down Expand Up @@ -65,8 +66,17 @@
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,

Check warning on line 77 in src/Id/SequenceGenerator.php

View check run for this annotation

Codecov / codecov/patch

src/Id/SequenceGenerator.php#L72-L77

Added lines #L72 - L77 were not covered by tests
);

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

Expand All @@ -79,8 +89,17 @@
];
}

/** @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,

Check warning on line 100 in src/Id/SequenceGenerator.php

View check run for this annotation

Codecov / codecov/patch

src/Id/SequenceGenerator.php#L95-L100

Added lines #L95 - L100 were not covered by tests
);

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

Expand Down
Loading