-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Add support for PHP 8.4 Lazy Objects RFC with configuration flag #11853
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
Merged
Merged
Changes from 14 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
b9973a7
Introduce PHP 8.4 lazy proxy/ghost API.
beberlei 77754a3
Call setRawValueWithoutLazyInitialization for support with lazy proxy.
beberlei 14bb33a
Merge branch '3.4.x' into ReflectionLazyGhost-3.4.x
beberlei e2079f9
Refactorings
beberlei db4cede
Revert test change partially and skip with lazy objects.
beberlei 325beaa
Houskeeping: phpcs
beberlei f362704
Run with ENABLE_LAZY_PROXY=1 in php 8.4 matrix.
beberlei dc0f3ac
Fix ci
beberlei 0d54881
Transient properties are not skipping lazy initialization anymore, to…
beberlei 4007d4a
Restore behavior preventing property hook use in 8.4 in unsupported c…
beberlei 65165f7
Add \ReflectionClass::SKIP_INITIALIZATION_ON_SERIALIZE
beberlei dea73d9
Rename isNativeLazyObjectsEnabled/enableNativeLazyObjects.
beberlei db057a2
Housekeeping: phpcs
beberlei 6b7a492
Update advanced-configuration docs and make proxy config variables no…
beberlei e32fc2f
Move code around
beberlei f957ef3
Merge branch '3.4.x' into ReflectionLazyGhost-3.4.x
beberlei 7fdc4e5
Apply suggestions from code review
beberlei 70f7ac5
Merge remote-tracking branch 'origin/3.4.x' into ReflectionLazyGhost-…
beberlei df41fa2
Merge remote-tracking branch 'beberlei/ReflectionLazyGhost-3.4.x' int…
beberlei d2c4729
Merge 3.4.x
beberlei 17a1d87
Pick suggestions
beberlei File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,7 +19,7 @@ steps of configuration. | |
|
|
||
| // ... | ||
|
|
||
| if ($applicationMode == "development") { | ||
| if ($applicationMode === "development") { | ||
| $queryCache = new ArrayAdapter(); | ||
| $metadataCache = new ArrayAdapter(); | ||
| } else { | ||
|
|
@@ -35,10 +35,14 @@ steps of configuration. | |
| $config->setProxyDir('/path/to/myproject/lib/MyProject/Proxies'); | ||
| $config->setProxyNamespace('MyProject\Proxies'); | ||
|
|
||
| if ($applicationMode == "development") { | ||
| $config->setAutoGenerateProxyClasses(true); | ||
| if (PHP_VERSION_ID > 80400) { | ||
| $config->enableNativeLazyObjects(true); | ||
| } else { | ||
| $config->setAutoGenerateProxyClasses(false); | ||
| if ($applicationMode === "development") { | ||
| $config->setAutoGenerateProxyClasses(true); | ||
| } else { | ||
| $config->setAutoGenerateProxyClasses(false); | ||
| } | ||
| } | ||
|
|
||
| $connection = DriverManager::getConnection([ | ||
|
|
@@ -71,9 +75,26 @@ Configuration Options | |
| The following sections describe all the configuration options | ||
| available on a ``Doctrine\ORM\Configuration`` instance. | ||
|
|
||
| Native Lazy Objects (***OPTIONAL***) | ||
|
||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
|
||
| With PHP 8.4 we recommend that you use native lazy objects instead of | ||
| the code generation approach using the symfony/var-exporter Ghost trait. | ||
beberlei marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| With Doctrine 4, the minimal requirement will become PHP 8.4 and native lazy objects | ||
| will become the only approach to lazy loading. | ||
|
|
||
| .. code-block:: php | ||
|
|
||
| <?php | ||
| $config->enableNativeLazyObjects(true); | ||
|
|
||
| Proxy Directory (***REQUIRED***) | ||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
|
||
| This setting is not required if you use native lazy objects with PHP 8.4 | ||
| and will be removed in the future. | ||
GromNaN marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| .. code-block:: php | ||
|
|
||
| <?php | ||
|
|
@@ -88,6 +109,9 @@ down. | |
| Proxy Namespace (***REQUIRED***) | ||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
|
||
| This setting is not required if you use native lazy objects with PHP 8.4 | ||
| and will be removed in the future. | ||
|
|
||
| .. code-block:: php | ||
|
|
||
| <?php | ||
|
|
@@ -200,6 +224,9 @@ deprecated ``Doctrine\DBAL\Logging\SQLLogger`` interface. | |
| Auto-generating Proxy Classes (***OPTIONAL***) | ||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
|
||
| This setting is not required if you use native lazy objects with PHP 8.4 | ||
| and will be removed in the future. | ||
|
|
||
| Proxy classes can either be generated manually through the Doctrine | ||
| Console or automatically at runtime by Doctrine. The configuration | ||
| option that controls this behavior is: | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.