333

How to migrate your application from Pimcore 6 to Pimcore 10?

By: Skynet Technologies USA LLC
May 13, 23
May 31, 23
Migrate Pimcore 6 to Pimcore 10

To stay competitive in the current dynamic market, you need to be abreast with the latest technologies. Using Pimcore itself makes your application efficient and future-proof. But to ensure its impeccability, you should keep updating it with new upgrades.

The Pimcore 6 has reached its end of life long back in 2021 and since then it is not receiving any updates. Thus, if your application is still using the outdated version, then you must migrate to the latest Pimcore 10. Keep reading the article!

YOU MAY ALSO LIKE: Pimcore MDM

Technical requirements to prepare your application for Pimcore 10 migration!

  • To upgrade application with Pimcore 10, you need PHP >= 8.0.
  • For servers, Apache >= 2.4 is needed.
  • Composer >= 2.0 is the basic requirement.
  • Database requirement is MariaDB >= 10.3 and MySQL >= 8.0.

YOU MAY ALSO LIKE: Pimcore 11

Some significant changes to be apply before the Pimcore upgrade!

  • Read Symfony Flex guidelines and update project folder structure accordingly.
  • Migrate the legacy modules, existing documents, static routes, and Document types to the new controller references in the format – AppBundle\Controller\FooController::barAction by using ./bin/console migration:controller-reference.
  • If existing document version files need to be migrated to Pimcore 10, then a run command is required pimcore:documents:migrate-elements to migrate deprecated property elements to editable.
  • Database configuration must include the following definition –

    doctrine:
      dbal:
        connections:
          default:
            mapping_types:
              enum: string
                bit: Boolean
    
  • Moreover, composer.json needs to be cleaned by using the following command –

    composer remove --no-update wikimedia/composer-merge-plugin doctrine/migrations php-http/guzzle6-adapter
    composer require --no-update php-http/guzzle7-adapter: ^0.1.1
    Update composer.json as per [skeleton](https://github.com/pimcore/skeleton/blob/10.x/composer.json)
    
  • Move configs from app/config/*.yml to config/*yaml
  • Templates need to move from app/Resources/views to templates. Also, bundles templates from app/Resources/XYZBundle/views to templates/bundles/XYZBundle.
  • Moreover, move app/AppKernel.php to src/Kervel.php and then edit it to have a namespace App with the class name Kernel.
  • Rename web/ to public/ and web/app.php to public/index.php
  • config/routing.yml should be renamed to config/routes.yaml
  • Do not forget to move environment-specific configs to config/packages/$ENV/*.yaml
  • And check the folder structure with skeleton project.

    Here are some additional helpers to make all changes:

    mv app/config/ config/
    mv web/ public/
    mv app/Resources/views/ templates/
    mv src/AppBundle/* src/
    mv public/app.php public/index.php
    mv app/AppKernel.php src/Kernel.php
    

YOU MAY ALSO LIKE: Magento Pimcore Intergration

Other steps for migrating Pimcore 6 to 10

1. ENV File

.env environment file is needed to add to the project root if it is not there already.

2. Migrate all PHP templates to Twig

PHP templates require to update to Twig because Pimcore 10 only supports Symfony 5, thus it dropped support for PHP templates. However, if you have Pimcore’s enterprise edition, then by installing pimcore/php-templating-engine-bundle, your PHP templates can get supported by Pimcore 10.

Use the below written RegEx to replace strings in your Templates files:

Rewrite {% extends ‘:Layout:default.html.twig’ %} to {% extends ‘Layout/default.html.twig’%}

However, you should not use this as a Batch process. Try it with the IDE to replace it manually.

3. Alter system settings

Pimcore config has changed, and now no extra keys are allowed under the Pimcore node, thereby it is essential to adapt new system settings as per system.template.yml and config.yaml.

And always remember –

  1. The Swiftmailer config has been removed
  2. Cache key renamed as full_page_cache
  3. Webservice config is also removed

4. Wipe out /tmp directories

Use following commands:

rm -r var/tmp
rm -r public/var/tmp

5. Flush the recycle bin as well

Pimcore 10 does not support Pimcore 6 items in the recycle bin. Thus, it is recommended that you flush all the items present in the recycle bin before migration.

rm -r var/recyclebin
TRUNCATE TABLE recyclebin;

6. Zipped data needs to be decompressed

Among myriad changes, it is also one of the profound changes in Pimcore 10. It does not support compressed version data. Thus, run the following command to decompress such data –

gzip -d -r var/versions/

7. Move user images

In Pimcore 10, the user images’ default location has been changed. So, now you need to move the content to the new location.

mkdir var/admin
mv var/user-image var/admin/user-image

8. Replace custom logo

Likewise, user images, custom logo location is also changed in Pimcore 10. Move it to the new location –

mkdir var/admin
mv var/config/custom-logo.* var/admin/custom-logo.image

9. Nginx Configuration

For Pimcore 10, .htaccess or Nginx configuration needs updates. Check Pimcore 10 documentation to know more about it.

10. And finally, shift to a new composer and PHP version to update the entire app!

As written above, Composer should update to version >= 2.0 and PHP version >= 8.0. Ensure they are on the updated versions and then run the following command:

Run composer update (COMPOSER_MEMORY_LIMIT=-1 composer update)

Verification of Pimcore migration execution is necessary!

Once the migration is done, do not forget to verify its execution. Though Composer update runs Pimcore migrations automatically; however, you must check it that every essential element has been migrated or not to ensure a seamless transition from Pimcore 6 to 10.

To verify, run the command –

./bin/console doctrine:migrations:up-to-date --prefix=Pimcore\\Bundle\\CoreBundle.

If there is an error message – [ERROR] Out-of-date! x migrations are available to execute.

Then run the below-written command for migration –

./bin/console doctrine:migrations:migrate --prefix=Pimcore\\Bundle\\CoreBundle.

Wrapping up

The latest Pimcore 10 has several new features and functionalities that make it better than Pimcore 6 such as the autosave function to save changes automatically in master data, easy editing of documents and adding content in CMS/DXP without reloading, translation of plural terms, etc.

So, migrate to Pimcore 10 and make your application robust and future-proof. As a Pimcore Silver Partner, we can help you with hassle-free migration without hampering data quality.

We also offer a range of Pimcore development services, such as PIM, MDM, DAM, CMS, design, multi-channel ecommerce, integration, maintenance, and support for a variety of clients, including SMEs, large businesses, international organizations, and web development agencies. Please feel free to contact us by filling out the following form or emailing us at [email protected] to learn more about the services we provide.