Preparing Pimcore for Version 11
Preparatory Work
-
Upgrade to version 10.5.x, if you are using a lower version.
-
[Security] Enable New Security Authenticator and adapt your security.yaml as per changes here :
security: enable_authenticator_manager: true
Points to consider when moving to new Authenticator:
- New authentication system works with password hasher factory instead of encoder factory.
- BruteforceProtectionHandler will be replaced with Login Throttling.
- Custom Guard Authenticator will be replaced with Http\Authenticator.
-
[Type hints] Check and add return type hints for classes extending Pimcore classes or implementing interfaces provided by Pimcore, based on the source phpdoc or comments on the methods. The return types will be added to Pimcore classes, so you
must
add return types to your classes extending Pimcore. You could use the patch-type-declarations tool, provided by symfony, to check for affected methods. For details please have a look here. -
[Javascript] Replace plugins with event listener as follows:
pimcore.registerNS("pimcore.plugin.MyTestBundle"); pimcore.plugin.MyTestBundle = Class.create(pimcore.plugin.admin, { getClassName: function () { return "pimcore.plugin.MyTestBundle"; }, initialize: function () { pimcore.plugin.broker.registerPlugin(this); }, preSaveObject: function (object, type) { var userAnswer = confirm("Are you sure you want to save " + object.data.general.o_className + "?"); if (!userAnswer) { throw new pimcore.error.ActionCancelledException('Cancelled by user'); } } }); var MyTestBundlePlugin = new pimcore.plugin.MyTestBundle();
document.addEventListener(pimcore.events.preSaveObject, (e) => { let userAnswer = confirm(`Are you sure you want to save ${e.detail.object.data.general.o_className}?`); if (!userAnswer) { e.preventDefault(); e.stopPropagation(); pimcore.helpers.showNotification(t("Info"), t("saving_failed") + ' ' + 'placeholder', 'info'); } });
-
[Javascript] Replace deprecated JS functions:
- Use t() instead of ts() for translations.
- Stop using
pimcore.helpers.addCsrfTokenToUrl
-
[Deprecations] Fix deprecations defined in the upgrade notes, which is to be removed in Pimcore 11. Tip: you can search for deprecations in Symfony Profiler(Debug mode) or can run linux command
tail -f var/log/dev.log | grep 'User Deprecated'
for checking deprecations on runtime. -
[Extensions] Stop using
var/config/extensions.php
for registering bundles, useconfig/bundle.php
instead. -
Don't use deprecated
Pimcore\Db\ConnectionInterface
interface,Pimcore\Db\Connection
class andPimcore\Db\PimcoreExtensionsTrait
trait UseDoctrine\DBAL\Driver\Connection
interface andDoctrine\DBAL\Connection
class instead. Some methods must be replaced:- Use
executeQuery()
instead ofquery()
- Use
executeStatement()
instead ofexecuteUpdate()
,deleteWhere()
,updateWhere()
- Use
fetchAssociative()
instead offetchRow()
- Use
fetchFirstColumn()
instead offetchCol()
- Use
Pimcore\Db\Helper::fetchPairs()
instead offetchPairs()
- Use
Pimcore\Db\Helper::upsert()
instead ofinsertOrUpdate()
- Use
Pimcore\Db\Helper::quoteInto()
instead ofquoteInto()
- Use
quoteIdentifier()
instead ofquoteColumnAs()
- Don't use
quoteTableAs()
- Don't use
limit()
- Use
Pimcore\Db\Helper::queryIgnoreError()
instead ofqueryIgnoreError()
- Use
Pimcore\Db\Helper::selectAndDeleteWhere()
instead ofselectAndDeleteWhere()
- Use
Pimcore\Db\Helper::escapeLike()
instead ofescapeLike()
- Use
-
[Deprecations] Constant
PIMCORE_PHP_ERROR_LOG
is deprecated and will be removed in Pimcore 11 -
[Config Environment] Replace deprecated setting write targets and storage directory in the .env file with symfony config
PIMCORE_WRITE_TARGET_IMAGE_THUMBNAILS=symfony-config PIMCORE_WRITE_TARGET_CUSTOM_REPORTS=settings-store PIMCORE_CONFIG_STORAGE_DIR_IMAGE_THUMBNAILS=/var/www/html/var/config/image-thumbnails
pimcore: config_location: image_thumbnails: write_target: type: 'symfony-config' options: directory: '/var/www/html/var/config/image-thumbnails' custom_reports: write_target: type: 'settings-store'
-
[System Settings] Appearance & Branding settings will be separated from the System settings in Pimcore 11 and stored in
var/config/admin_system_settings/admin_system_settings.yaml
by default. To save these settings into the settings store, you will need to add following to your configuration:
pimcore_admin:
config_location:
admin_system_settings:
write_target:
type: 'settings-store'
read_target:
type: 'settings-store'
System Settings will implement LocationAwareConfigRepository in Pimcore 11. All relevant settings from system.yaml
will be stored in var/config/system_settings/system_settings.yaml
by default.
To save system settings into the settings store, you will need to add following to your configuration:
pimcore:
config_location:
system_settings:
write_target:
type: 'settings-store'
read_target:
type: 'settings-store'
- [Web2Print] Please keep in mind that the deprecated processor
HeadlessChrome
needs to be replaced with the new processorChrome
in Pimcore 11.