Update code to v3¶
Before you start this procedure, make sure you have completed the previous step, Updating to v3.2.
4. Update the code¶
To adapt you installation to v3, you need to make a number of modifications to your code.
New project structure¶
The latest Symfony versions changed the organization of your project into folders and bundles. When updating to eZ Platform v3 you need to move your files and modify file paths and namespace references.
Configuration files have been moved from
Package-specific configuration is placed in
This folder also contains
config/packages/ezplatform.yaml, which contains all settings coming in from Kernel.
PHP code and bundle organization¶
Since Symfony 4
src/ code is no longer organized in bundles,
AppBundle has been removed from the default eZ Platform install.
In order to adapt, you'll need to move all your PHP code, such as controllers or event listeners, to the
src folder and use the
App namespace for your custom code instead.
How to make AppBundle continue to work, for now
Refactoring bundles for
src/ folder can involve extensive changes, if you want to make your
src/AppBundle continue to work, follow an Autoloading src/AppBundle guide on Symfony Casts.
1 2 3
Once you are ready to refactor the code to
App namespace, follow Bye Bye AppBundle article.
Templates are no longer stored in
You need to move all your templates to the
templates folder in your project's root.
Translation files have been moved out of
translations in your project's root.
web and assets¶
Content of the
web folder is now placed in
app/Resources/assets has been moved to
You also need to update paths that refer to the old location,
for example in
Full list of deprecations
If you encounter any issue during the upgrade, see eZ Platform v3.0 deprecations for details of all required changes to your code.
Because eZ Platform v3 is based on Symfony 5, you need to make sure all additional third-party dependencies that your project uses have been adapted to Symfony 5.
Automatic code refactoring - non-essential step¶
To simplify the process of adapting your code to Symfony 5, you can use Rector, a reconstructor tool that will automatically refactor your Symfony and PHPunit code.
To properly refactor your code, you might need to run the Rector
process command for each Symfony version from 4.0 to 5.0 in turn:
vendor/bin/rector process src --set symfony40
You can find all the available sets in the Rector repository. Keep in mind that after automatic refactoring finishes there might be some code chunks that you need to fix manually.
Update code for specific parts of the system¶
Now, go through the following steps and ensure all your code is up to date with v3: