mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
[3.4.0] TypeError from ProxyFactory::__construct() when using native lazy objects #7520
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @eisnstein on GitHub (Jun 16, 2025).
Bug Report
Summary
When using the new native lazy objects, I get an TypeError in the EntityManager constructor, when it tries to create a ProxyFactory. $proxyDir and $proxyNs need to be strings, but because those are not set, nulls are given.
My workaround is to set empty strings:
PHP Version: 8.4.8
Stack Trace:
@greg0ire commented on GitHub (Jun 16, 2025):
Can you please provide a stack trace?
@eisnstein commented on GitHub (Jun 17, 2025):
@greg0ire added stack trace
@greg0ire commented on GitHub (Jun 17, 2025):
Oh OK, I see… may I ask why you are not using
ORMSetup, as described in https://www.doctrine-project.org/projects/doctrine-orm/en/3.4/reference/configuration.html#obtaining-an-entitymanager ?@eisnstein commented on GitHub (Jun 17, 2025):
@greg0ire I still had the setup from the advanced configuration: https://www.doctrine-project.org/projects/doctrine-orm/en/3.4/reference/advanced-configuration.html
But thanks, I changed it to the ORMSetup and that works.
@greg0ire commented on GitHub (Jun 17, 2025):
Right, let's keep this issue opened then.
@greg0ire commented on GitHub (Jun 17, 2025):
I think it would be OK to relax the type declarations here, since there are checks for both arguments:
ab89517093/src/Proxy/ProxyFactory.php (L150-L156)@greg0ire commented on GitHub (Jun 17, 2025):
@eisnstein may I ask why it worked before you migrate to native lazy objects? Did you explicitly provide a proxy dir and proxy namespace, or did something else do it for you?
@eisnstein commented on GitHub (Jun 17, 2025):
@greg0ire exactly, I explicitly set the proxy dir and namespace.