@@ -132,6 +132,9 @@ public function __serialize(): array
132132 /** @var array<class-string, Closure> */
133133 private array $ proxyFactories = [];
134134
135+ private readonly string $ proxyDir ;
136+ private readonly string $ proxyNs ;
137+
135138 /**
136139 * Initializes a new instance of the <tt>ProxyFactory</tt> class that is
137140 * connected to the given <tt>EntityManager</tt>.
@@ -143,8 +146,8 @@ public function __serialize(): array
143146 */
144147 public function __construct (
145148 private readonly EntityManagerInterface $ em ,
146- private readonly string $ proxyDir ,
147- private readonly string $ proxyNs ,
149+ string | null $ proxyDir = null ,
150+ string | null $ proxyNs = null ,
148151 bool |int $ autoGenerate = self ::AUTOGENERATE_NEVER ,
149152 ) {
150153 if (! $ proxyDir && ! $ em ->getConfiguration ()->isNativeLazyObjectsEnabled ()) {
@@ -159,6 +162,17 @@ public function __construct(
159162 throw ORMInvalidArgumentException::invalidAutoGenerateMode ($ autoGenerate );
160163 }
161164
165+ if ($ proxyDir === null && $ em ->getConfiguration ()->isNativeLazyObjectsEnabled ()) {
166+ $ proxyDir = '' ;
167+ }
168+
169+ if ($ proxyNs === null && $ em ->getConfiguration ()->isNativeLazyObjectsEnabled ()) {
170+ $ proxyNs = '' ;
171+ }
172+
173+ $ this ->proxyDir = $ proxyDir ;
174+ $ this ->proxyNs = $ proxyNs ;
175+
162176 $ this ->uow = $ em ->getUnitOfWork ();
163177 $ this ->autoGenerate = (int ) $ autoGenerate ;
164178 $ this ->identifierFlattener = new IdentifierFlattener ($ this ->uow , $ em ->getMetadataFactory ());
0 commit comments