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

Ensure compatibility with persistence 4 #2669

Merged
merged 1 commit into from
Sep 9, 2024

Conversation

greg0ire
Copy link
Member

@greg0ire greg0ire commented Jul 6, 2024

This is mostly about adding return type declarations. In one instance though, it is more than that: ClassMetadataFactory redeclares $cacheSalt, a protected property inherited from the persistence package. Since it is not possible to widen or narrow the type, and since the redeclaration seems to be about setting a default value, let us set it in the constructor.

This is mostly about adding return type declarations. In one instance
though, it is more than that: ClassMetadataFactory redeclares
$cacheSalt, a protected property inherited from the persistence package.
Since it is not possible to widen or narrow the type, and since the
redeclaration seems to be about setting a default value, let us set it
in the constructor.
{
$this->unitOfWork->initializeObject($obj);
}

/**
* Helper method to check whether a lazy loading proxy or persistent collection has been initialized.
*/
public function isUninitializedObject(object $obj): bool
public function isUninitializedObject(mixed $obj): bool
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How come it's mixed in persistence?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't find the original discussion, but the argument was that if this wasn't mixed, every check would have to be is_object($obj) && $dm->isUninitializedObject($obj). The idea is that anything that isn't an object also isn't an uninitialised object. There was some pushback to changing the interface, and I honestly didn't care enough to force the issue 🤷

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for digging this up

Copy link
Member

@alcaeus alcaeus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, and I also don't see any changes that we'd want to announce as deprecations in 2.x 👍

@malarzm
Copy link
Member

malarzm commented Jul 9, 2024

LGTM, and I also don't see any changes that we'd want to announce as deprecations in 2.x 👍

There's still DocumentManager::merge and NOTIFY tracking policy on the hook

@greg0ire greg0ire marked this pull request as ready for review July 9, 2024 10:16
@alcaeus alcaeus merged commit 296b025 into doctrine:3.0.x Sep 9, 2024
16 of 17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants