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

Make the doctrine/common dependency optional #2904

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

derrabus
Copy link

@derrabus derrabus commented Dec 16, 2024

Doctrine ORM has moved away from the Doctrine Common proxy implementation. Yet, this package still forces the installation of doctrine/common.

The only class that we need from doctrine/common is ClassUtils which can resolve proxy class names. However, if doctrine/common is not installed, we can be sure that we won't encounter any Common proxies and fall back to get_class(). This class introduces a new utility method that does exactly that.

@phansys
Copy link
Collaborator

phansys commented Dec 16, 2024

Thanks @derrabus!

IIUC, I see other uses that also need to be replaced. By instance:

@derrabus
Copy link
Author

That particular usage is safe. The Proxy interface is used in an instanceof check which is safe to perform on an undefined interface.

@derrabus
Copy link
Author

That being said, $x instanceof Proxy is not a safe way to check if a given object is a proxy because it misses proxies that have been created with a different strategy (e.g. lazy ghosts). But fixing that is a bit out of scope for my PR.

@phansys phansys requested a review from franmomu December 16, 2024 13:25
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.

2 participants