File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed
Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -39,9 +39,16 @@ protected function initialize(): void
3939
4040 $ config = new Configuration ();
4141 $ config ->setMetadataDriverImpl (count ($ drivers ) === 1 ? $ drivers [0 ] : new MappingDriverChain ($ drivers ));
42- $ config ->setAutoGenerateProxyClasses (true );
43- $ config ->setProxyDir ($ this ->tmpDir );
44- $ config ->setProxyNamespace ('__PHPStanDoctrine__ \\Proxy ' );
42+
43+ // @phpstan-ignore function.impossibleType (Available since Doctrine ORM 3.4)
44+ if (PHP_VERSION_ID >= 80400 && method_exists ($ config , 'enableNativeLazyObjects ' )) {
45+ $ config ->enableNativeLazyObjects (true );
46+ } else {
47+ $ config ->setAutoGenerateProxyClasses (true );
48+ $ config ->setProxyDir ($ this ->tmpDir );
49+ $ config ->setProxyNamespace ('__PHPStanDoctrine__ \\Proxy ' );
50+ }
51+
4552 $ connection = DriverManager::getConnection ([
4653 'driver ' => 'pdo_sqlite ' ,
4754 'memory ' => true ,
You can’t perform that action at this time.
0 commit comments