-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Open
Labels
Progress: ready for groomingReported on 2.4.xIndicates original Magento version for the Issue report.Indicates original Magento version for the Issue report.feature request
Description
This issue is automatically created based on existing pull request: #40567: Modify createClassDefinition to include application mode
Disable runtime code generation in production mode
Description
This patch stops Magento from generating Interceptors, Factories, and Proxies at runtime when running in production mode.
In production, all generated classes must be created beforehand by bin/magento setup:di:compile. If they are missing (for example after generated/code is cleared during deployment), Magento should fail with a clear error instead of generating them on the fly.
Changes
- DefinitionFactory: Registers the Generator Autoloader only when the application mode is not
production. - ObjectManagerFactory: Passes the application mode from deployment config into
createClassDefinition().
Behaviour
| Mode | Generator Autoloader | Runtime generation |
|---|---|---|
| developer | Registered | Yes |
| default | Registered | Yes |
| production | Not registered | No |
Requirements
- Run
bin/magento setup:di:compileduring deployment before serving traffic. - Ensure
generated/codeis populated before going live.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Progress: ready for groomingReported on 2.4.xIndicates original Magento version for the Issue report.Indicates original Magento version for the Issue report.feature request
Type
Projects
Status
No status