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

Remove Serializable implementation #11469

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
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
5 changes: 0 additions & 5 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -206,11 +206,6 @@
<code><![CDATA[$entity]]></code>
</PossiblyNullArgument>
</file>
<file src="src/Id/SequenceGenerator.php">
<ParamNameMismatch>
<code><![CDATA[$serialized]]></code>
</ParamNameMismatch>
</file>
<file src="src/Internal/Hydration/AbstractHydrator.php">
<ReferenceConstraintViolation>
<code><![CDATA[return $rowData;]]></code>
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
Loading