Prepare for Pimcore 11
First of all we need to update your Pimcore 10 to the last 10.x version.
- Update your .html.php to .html.twig files
- Check all return Type hints
- Replace your JS from your Bundles with event listeners
- Fix some deprecations from log file
- Install symfony/dotenv
- Check the migrations
- Remove all o_ from your mysql queries
In detail you should follow the Pimcore docs here: Prepare for V11 Steps
Step 1: Pre Check
Thumbnails:
- If thumbnails not generate by Pimcore 10 you need to check if the .yaml files are generated (look here: "/var/config/image-thumbnails.php" and "/var/config/video-thumbnails.php")
- You should save all thumbnails before you update to v11 (maybe manual or you can write a command for it)
Same step as the Thumbnails should be done for:
- Static Routes: "/var/config/static-routes.php"
- Predefined Properties: "/var/config/predefined-properties.php"
- Document Types: "/var/config/document-types.php"
Messenger Queue:
- Check if the queue is empty! (bin/console messenger:consume xxx)
Migrations:
- Check updates: "bin/console doctrine:migrations:up-to-date" or update with: "bin/console doctrine:migrations:migrate"
Database Config:
- check if and how server_version is defined 15.1 for example will not work. Should be mariadb-10.5.19
Step 2: Security
Change the security.yml
to the new authenticator
security:
enable_authenticator_manager: true
Update packages/security.yaml
to https://github.com/pimcore/skeleton/blob/11.x/config/packages/security.yaml
Merge all manual security.yaml
files.
Step 3: Class Definitions
Check Type hints in classes!
The Migrations after the Update Process can bring many "MANY" more of this replacements!
In the Error messages of the migration process you can see witch errors appear and then you can replace the values in your class definition folder.
Here some default errors you can fix. Left should replaced with the right string.
'childs' -> 'children'
'listingParentClass' => NULL, -> 'listingParentClass' => '',
'useTraits' => NULL, -> 'useTraits' => '',
'listingUseTraits' => NULL, -> 'listingUseTraits' => '',
'maxTabs' => '', -> 'maxTabs' => NULL,
'maxItems' => '', -> 'maxItems' => NULL,
'index' => '', -> 'index' => NULL,
'collapsed' => '', -> 'collapsed' => false,
'description' => NULL, -> 'description' => '',
'showAppLoggerTab' => NULL, -> 'showAppLoggerTab' => false,
'parentClass' => NULL, -> 'parentClass' => '',
'rows' => '', -> 'rows' => NULL
Step 4: Bundles
- migrate the
var/config/extensions.php
to `config/bundles.php``
Step 5: Rector
Optional but helpfull
Use rector for some update process.
Rector Website
In this example rule we automaticly update your src folder to php8.2 and symfony 6.2.
You should check the rector with a --dry-run
!
// register a single rule
$rectorConfig->rules(
[
InlineConstructorDefaultToPropertyRector::class,
ReturnTypeFromStrictNativeCallRector::class,
ReturnTypeFromStrictScalarReturnExprRector::class,
Pimcore11Replace::class,
]
);
// define sets of rules
$rectorConfig->sets([
LevelSetList::UP_TO_PHP_82,
\Rector\Symfony\Set\SymfonyLevelSetList::UP_TO_SYMFONY_62,
]);
Step 6: Routes
routes.yaml
# OLD
_pimcore:
resource: "@PimcoreCoreBundle/Resources/config/routing.yml"
# NEW
_pimcore:
resource: "@PimcoreCoreBundle/config/routing.yaml"
routes/dev/routes.yaml
# OLD
_pimcore:
resource: "@PimcoreCoreBundle/Resources/config/routing_dev.yml"
# NEW
_pimcore:
resource: "@PimcoreCoreBundle/config/routing_dev.yaml"
Step 7: Cache
Change your cache pool if you use redis
# OLD
framework:
cache:
pools:
pimcore.cache.pool:
public: true
tags: true
default_lifetime: 31536000 # 1 year
adapter: pimcore.cache.adapter.redis_tag_aware
provider: 'redis://localhost'
# NEW
framework:
cache:
pools:
pimcore.cache.pool:
public: true
tags: true
default_lifetime: 31536000 # 1 year
adapter: cache.adapter.redis_tag_aware
provider: 'redis://%env(REDIS_CACHE_HOST)%'
Step 8: Composer Update
Update your compose.json
and set the pimcore version to ^11.0
composer update
Step 9: Fix something
Sql Queries
Search in your files for the o_
and remove the prefix. (o_id, o_creationDate, o_modificationDate, o_path, ...)
DefaultController - defaultAction
Change your defaultAction to:
use Symfony\Bridge\Twig\Attribute\Template;
#[Template('Default/default.html.twig')]
public function defaultAction(Request $request)
{
}
Userowner Fix
During updates, it may happen that documents/assets/objects were created with a Pimcore user who has since been deleted. In such cases, the userOwner in the database is null, which Pimcore no longer allows. Simply set it to 0 ( = system).
update documents set userOwner = 0 where userOwner IS NULL;
update objects set userOwner = 0 where userOwner IS NULL;
update assets set userOwner = 0 where userOwner IS NULL;
Intl Bundle (Symfony)
By default the symfony/intl
is not installed anymore!
You can reinstall it or you can use for countries: Pimcore\Localization\LocaleService->getDisplayRegions( $locale )
and get an array like this:
[ 'AT' => 'Austria', 'DE' => 'Germany' ]
Step 10: WYSIWYG Editor (new)
Pimcore has changed the WYSIWYG editor from CKEditor to TinyMce!
HTML Tags
The new editor only allows some HTML Tags.
It is Important to check this before you open and save documents, wysiwyg and so on.
Max Length
The WYSIWYG has a max length of 20000
chars incl. whitespaces!
Here an example:
framework:
html_sanitizer:
sanitizers:
pimcore.wysiwyg_sanitizer:
allow_elements:
h1: [ 'class', 'id' ]
h2: [ 'class', 'id' ]
h3: [ 'class', 'id' ]
h4: [ 'class', 'id' ]
h5: [ 'class', 'id' ]
h6: [ 'class', 'id' ]
# ggf. weitere
# für die maxmial länge
max_input_length: 100000
Step 11: Options provider
If you want an Object Listing from an object, it can result in an endless loop!
Maybe it would fixed in a future version but here an example (or use an other solution):
# OLD
public function getOptions($context, $fieldDefinition): array
{
$result = [];
$configs = new RoleConfig\Listing();
foreach($configs as $scope){
$result[] = [
'key' => 'ROLE_' . strtoupper($scope->getInternalName()),
'value' => 'ROLE_' . strtoupper($scope->getInternalName())
];
}
return $result;
}
# NEW
public function getOptions($context, $fieldDefinition): array
{
$result = [];
$db = \Pimcore\Db::get();
$sql = "SELECT `internalName` FROM object_XXXX";
$stmt = $db->fetchAllAssociative($sql);
foreach($stmt as $row){
$result[] = [
'key' => 'ROLE_' . strtoupper($row['internalName']),
'value' => 'ROLE_' . strtoupper($row['internalName'])
];
}
return $result;
}
Step 12: Pimcore Bundles
Check your installed Bundles: bin/console pimcore:bundle:list
// enable in Bundles.php
return [
Pimcore\Bundle\ApplicationLoggerBundle\PimcoreApplicationLoggerBundle::class => ['all' => true],
];
// Install over CLI
bin/console pimcore:bundle:install PimcoreApplicationLoggerBundle
Attention:
When installing core bundles (updating from 10 to 11, running migrations), it may happen that certain permissions are already set. You just need to remove these permissions from the users_permission_definitions table
.
List of Core Bundle:
- PimcoreSeoBundle
- PimcoreStaticRoutesBundle
- PimcoreTinymceBundle
- PimcoreCustomReportsBundle
- PimcoreGlossaryBundle
- PimcoreSimpleBackendSearchBundle
- PimcoreUuidBundle
- PimcoreWordExportBundle
- PimcoreXliffBundle
Core Bundles are installed with Pimcore!
The Pimcore E-Commerce Framework is now a Comminty Bundle so you need to install this from the Repository!
Have Fun!
Have fun and write some comments if you need Help or share some Informations with us!
Comments (0)
-
No Comments