Skip to content

2_1_0_migration_from_2_0_0

Aurélien FOUCRET edited this page Jun 14, 2016 · 8 revisions

Migration from ElasticSuite 2.0.0 to ElasticSuite 2.1.0

Why is ElasticSuite 2.1.0 not backward compatible with ElasticSuite 2.0.0 ?

During the development process we realize that few things need to be fixed to match Magento 2.x development standards :

  • First the composer vendor name we were previously using (smile-sa), is not compliant with the standard used in Magento since it have to match the PHP namespace we use into the code. As a result static tests will raise a lot of warning if we had not changed our vendor name from smile-sa to smile

  • Second, and always regarding Magento strict policy, PHP namespaces and module name have to follow a strict policy. As a result our modules and PHP namespaces have to be renamed (notice the subtile case variation) :

    • Smile_ElasticSuite* to Smile_Elasticsuite* for the modules names
    • \Smile\ElasticSuite*\ to \Smile\Elasticsuite*` for the PHP namespaces.

Renaming everything was an uneasy decision to be made since it does break backward compatibility when updating to version 2.1.0. But as the module is still in its early stages we consider it was the best decision to be taken since the number of errors raised by static testing made the module quite uncomfortable to work with.

It is an exceptional decision which concerns only version 2.1.0 of the module which is still young. Future updates will be as simple as just running composer update.

Migration to ElasticSuite 2.1.0 How to ?

Adjust your composer setup

First of all you will need adjust you composer installation by removing the old package using the old package vendor name :

composer remove "smile-sa/elasticsuite" --no-update

Then append the new ElasticSuite version :

composer require "smile/elasticsuite" "2.1.0" --no-update

Then you can run the composer install and clean all local caches and DI :

composer update
bin/magento cache:clean
bin/magento cache:flush
rm -rf var/di var/generation

Database fix

Before running the Magento database update script, you will need to clean the database to remove all previously installed ElasticSuite modules. It is required since we changed the case of the module name.

As our setup script is reentrant you can safely just drop the ElasticSuite modules setup rows from the setup_module without care about data eventual data loss :

DELETE FROM setup_module WHERE module LIKE 'Smile_ElasticSuite%'

In the end you will have to run the Magento upgrade script, reindex and deploy static content everything through :

bin/magento setup:upgrade
bin/magento indexer:reindex
bin/magento setup:static-content:deploy
bin/magento cache:clean
bin/magento cache:flush
rm -rf var/di var/generation

Code fix

As explained above, both modules names and PHP namespaces have been updated.

As a result you will need to fix your own code to reflect those changes :

  • All references to our classes have to be update. You will need to replace all reference to Smile\ElasticSuite* by reference to Smile\Elasticsuite*

  • Do not forget to update references into you DI config where variations can appears such as Smile\\ElasticSuite

  • The module names have been updated, so all references to Smile_ElasticSuite* would need a replacement by ``Smile_Elasticsuite*`

  • Be careful since the module name can appears into your themes as a folder name (eg: theme-mysupertheme/Smile_ElasticSuiteCatalog). The case of these folders have to be updated too.

Clone this wiki locally