Skip to main content
Version: Thelia 2

Update

Update components

Set the version you want in your composer.json:

"thelia/thelia-skeleton": "~2.6.2"

Then run:

composer update

composer update thelia/thelia-skeleton 2.6.2 does not work: Composer reads 2.6.2 as a second package name. Use composer require thelia/thelia-skeleton:~2.6.2 if you prefer a single command.

Update the database

Updating the files is never enough. Most releases ship an SQL script that alters the schema, and a site running new files on an old database will break. Run the update script from the root of your installation:

php local/setup/update.php

The script reads the thelia_version configuration variable from your database and replays every update script between that version and the one your files are at, in order. Going from 2.5.4 to 2.6.2 applies 2.5.5, 2.6.0, 2.6.1 and 2.6.2 in a single run, so there is no need to upgrade one version at a time.

It offers to back up your database first, and restores that backup if a script fails. On a large database, prefer a manual mysqldump taken before you start.

Clear the cache

php Thelia cache:clear
php Thelia cache:clear --env=prod

If the command fails, empty the var/cache and web/cache directories by hand.

Migrate from Thelia < 2.4 to 2.5

Module made for Thelia <= 2.4 are not compatible with the new version of Thelia, but there is no lot of change to make it compatible.

Module

  • Some functions in BaseModule had their return type set, because you are overwriting them you need to set their return type as well
  • If you want to enable autowiring in your module you must add this function in your base class :
public static function configureServices(ServicesConfigurator $servicesConfigurator): void
{
$servicesConfigurator->load(self::getModuleCode().'\\', __DIR__)
->exclude([THELIA_MODULE_DIR . ucfirst(self::getModuleCode()). "/I18n/*"])
->autowire(true)
->autoconfigure(true);
}

Propel

  • In schema.xml change the database name from Thelia to TheliaMain
  • If some model has been generated by Propel in Model/Base and Model/Map remove these two folders, they are now generated in the cache

Forms

  • Form type alias name doesn't work anymore, you have to use the fully qualified class name, like TextType::class instead of text
  • For choices parameter in choice type invert the label and value
  • The getName() must be static
  • Form name must not contain dot . replace it with an underscore _ (don't forget to replace it in your templates)
  • The callback constraints structure has changed
  • In controllers don't call new MyForm(); to create your form but createForm(FormClassName::getName())

Dispatcher

  • Arguments in dispatch function are inverted, the event object is the first argument and event name is the second

Smarty

  • If you try to access to a not defined variable in Smarty it will now throw an error, you have to either do a check before using it or adding a default value like this {$var|default:null}