@@ -19,7 +19,7 @@ steps of configuration.
19
19
20
20
// ...
21
21
22
- if ($applicationMode == "development") {
22
+ if ($applicationMode === "development") {
23
23
$queryCache = new ArrayAdapter();
24
24
$metadataCache = new ArrayAdapter();
25
25
} else {
@@ -35,10 +35,14 @@ steps of configuration.
35
35
$config->setProxyDir('/path/to/myproject/lib/MyProject/Proxies');
36
36
$config->setProxyNamespace('MyProject\Proxies');
37
37
38
- if ($applicationMode == "development" ) {
39
- $config->setAutoGenerateProxyClasses (true);
38
+ if (PHP_VERSION_ID > 80400 ) {
39
+ $config->enableNativeLazyObjects (true);
40
40
} else {
41
- $config->setAutoGenerateProxyClasses(false);
41
+ if ($applicationMode === "development") {
42
+ $config->setAutoGenerateProxyClasses(true);
43
+ } else {
44
+ $config->setAutoGenerateProxyClasses(false);
45
+ }
42
46
}
43
47
44
48
$connection = DriverManager::getConnection([
@@ -71,9 +75,26 @@ Configuration Options
71
75
The following sections describe all the configuration options
72
76
available on a ``Doctrine\ORM\Configuration `` instance.
73
77
78
+ Native Lazy Objects (***OPTIONAL* **)
79
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
80
+
81
+ With PHP 8.4 we recommend that you use native lazy objects instead of
82
+ the code generation approach using the symfony/var-exporter Ghost trait.
83
+
84
+ With Doctrine 4, the minimal requirement will become PHP 8.4 and native lazy objects
85
+ will become the only approach to lazy loading.
86
+
87
+ .. code-block :: php
88
+
89
+ <?php
90
+ $config->enableNativeLazyObjects(true);
91
+
74
92
Proxy Directory (***REQUIRED* **)
75
93
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
76
94
95
+ This setting is not required if you use native lazy objects with PHP 8.4
96
+ and will be removed in the future.
97
+
77
98
.. code-block :: php
78
99
79
100
<?php
88
109
Proxy Namespace (***REQUIRED* **)
89
110
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
90
111
112
+ This setting is not required if you use native lazy objects with PHP 8.4
113
+ and will be removed in the future.
114
+
91
115
.. code-block :: php
92
116
93
117
<?php
@@ -200,6 +224,9 @@ deprecated ``Doctrine\DBAL\Logging\SQLLogger`` interface.
200
224
Auto-generating Proxy Classes (***OPTIONAL* **)
201
225
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
202
226
227
+ This setting is not required if you use native lazy objects with PHP 8.4
228
+ and will be removed in the future.
229
+
203
230
Proxy classes can either be generated manually through the Doctrine
204
231
Console or automatically at runtime by Doctrine. The configuration
205
232
option that controls this behavior is:
0 commit comments