Skip to content

Latest commit

 

History

History
241 lines (188 loc) · 16 KB

UPGRADE-2.0.md

File metadata and controls

241 lines (188 loc) · 16 KB

UPGRADE FROM 1.7 to 1.8

Table of Contents:

Disclaimer

Please check that you're using Akeneo PIM v1.7

We're assuming that you created your project from the standard distribution

This documentation helps to migrate projects based on the Community Edition and the Enterprise Edition

Please perform a backup of your database before proceeding to the migration. You can use tools like mysqldump and mongodump.

Please perform a backup of your codebase if you don't use a VCS (Version Control System).

Migrate your standard project

  1. Download it from the website PIM community standard and extract:
TODO
  1. Copy the following files to your PIM installation:
export PIM_DIR=/path/to/your/pim/installation
cp var/SymfonyRequirements.php $PIM_DIR/app
cp app/PimRequirements.php $PIM_DIR/app

mv $PIM_DIR/app/config/pim_parameters.yml $PIM_DIR/app/config/pim_parameters.yml.bak
cp app/config/pim_parameters.yml $PIM_DIR/app/config

mv $PIM_DIR/composer.json $PIM_DIR/composer.json.bak
cp composer.json $PIM_DIR/
  1. Update the configuration of your application $PIM_DIR/app/config/config.yml to add these new lines:
TODO
  1. Update your application Kernel $PIM_DIR/app/AppKernel.php:
  • Remove the following bundles:
Oro\Bundle\NavigationBundle\OroNavigationBundle
Pim\Bundle\JsFormValidationBundle\PimJsFormValidationBundle
APY\JsFormValidationBundle\APYJsFormValidationBundle
Oro\Bundle\RequireJSBundle\OroRequireJSBundle(),
  1. Then remove your old upgrades folder:
rm -rf $PIM_DIR/upgrades/schema
  1. Now update your dependencies:
  • [Optional] If you had added dependencies to your project, you will need to do it again in your composer.json. You can display the differences of your previous composer.json in $PIM_DIR/composer.json.bak.
{
    "require": {
        "your/dependency": "version",
        "your/other-dependency": "version"
    }
}
  • Then run the command to update your dependencies:
php -d memory_limit=3G composer update

This step will copy the upgrades folder from pim-community-dev/ to your Pim project root in order to migrate. If you have custom code in your project, this step may raise errors in the "post-script" command. In this case, go to the chapter "Migrate your custom code" before running the database migration.

  1. Then you can migrate your database using:
rm -rf var/cache
php bin/console doctrine:migration:migrate --env=prod
  1. Then, generate JS translations and re-generate the PIM assets:
TODO

Migrate your custom code

We extracted the "values" logic outside of products. It means that any entity having the EntityWithValuesInterface would be able to be processed. As a reminder, a value is composed of an attribute, a locale, a scope, and a data. As values are not only for product anymore, we decided to rename ProductValueInterface to ValueInterface. This impacts a lot of classes too.

The following commands help to migrate references to these classes or services.

## Classes
find ./src/ -type f -print0 | xargs -0 sed -i 's/Pim\\Bundle\\VersioningBundle\\Normalizer\\Flat\\AbstractProductValueDataNormalizer/Pim\\Bundle\\VersioningBundle\\Normalizer\\Flat\\AbstractValueDataNormalizer/g'
find ./src/ -type f -print0 | xargs -0 sed -i 's/Pim\\Bundle\\VersioningBundle\\Normalizer\\Flat\\ProductValueNormalizer/Pim\\Bundle\\VersioningBundle\\Normalizer\\Flat\\ValueNormalizer/g'
find ./src/ -type f -print0 | xargs -0 sed -i 's/Pim\\Component\\Catalog\\Completeness\\Checker\\ProductValueCompleteChecker/Pim\\Component\\Catalog\\Completeness\\Checker\\ValueCompleteChecker/g'
find ./src/ -type f -print0 | xargs -0 sed -i 's/Pim\\Component\\Catalog\\Completeness\\Checker\\ProductValueCompleteCheckerInterface/Pim\\Component\\Catalog\\Completeness\\Checker\\ValueCompleteCheckerInterface/g'
find ./src/ -type f -print0 | xargs -0 sed -i 's/Pim\\Component\\Catalog\\Factory\\ProductValue\\DateProductValueFactory/Pim\\Component\\Catalog\\Factory\\Value\\DateValueFactory/g'
find ./src/ -type f -print0 | xargs -0 sed -i 's/Pim\\Component\\Catalog\\Factory\\ProductValue\\MediaProductValueFactory/Pim\\Component\\Catalog\\Factory\\Value\\MediaValueFactory/g'
find ./src/ -type f -print0 | xargs -0 sed -i 's/Pim\\Component\\Catalog\\Factory\\ProductValue\\MetricProductValueFactory/Pim\\Component\\Catalog\\Factory\\Value\\MetricValueFactory/g'
find ./src/ -type f -print0 | xargs -0 sed -i 's/Pim\\Component\\Catalog\\Factory\\ProductValue\\OptionProductValueFactory/Pim\\Component\\Catalog\\Factory\\Value\\OptionValueFactory/g'
find ./src/ -type f -print0 | xargs -0 sed -i 's/Pim\\Component\\Catalog\\Factory\\ProductValue\\OptionsProductValueFactory/Pim\\Component\\Catalog\\Factory\\Value\\OptionsValueFactory/g'
find ./src/ -type f -print0 | xargs -0 sed -i 's/Pim\\Component\\Catalog\\Factory\\ProductValue\\PriceCollectionProductValueFactory/Pim\\Component\\Catalog\\Factory\\Value\\PriceCollectionValueFactory/g'
find ./src/ -type f -print0 | xargs -0 sed -i 's/Pim\\Component\\Catalog\\Factory\\ProductValue\\ProductValueFactoryInterface/Pim\\Component\\Catalog\\Factory\\Value\\ValueFactoryInterface/g'
find ./src/ -type f -print0 | xargs -0 sed -i 's/Pim\\Component\\Catalog\\Factory\\ProductValue\\ScalarProductValueFactory/Pim\\Component\\Catalog\\Factory\\Value\\ScalarValueFactory/g'
find ./src/ -type f -print0 | xargs -0 sed -i 's/Pim\\Component\\Catalog\\Factory\\ProductValueCollectionFactory/Pim\\Component\\Catalog\\Factory\\ProductValueCollectionFactory/g'
find ./src/ -type f -print0 | xargs -0 sed -i 's/Pim\\Component\\Catalog\\Factory\\ProductValueFactory/Pim\\Component\\Catalog\\Factory\\ValueFactory/g'
find ./src/ -type f -print0 | xargs -0 sed -i 's/Pim\\Component\\Catalog\\ProductValue\\DateProductValue/Pim\\Component\\Catalog\\Value\\DateValue/g'
find ./src/ -type f -print0 | xargs -0 sed -i 's/Pim\\Component\\Catalog\\ProductValue\\MediaProductValue/Pim\\Component\\Catalog\\Value\\MediaValue/g'
find ./src/ -type f -print0 | xargs -0 sed -i 's/Pim\\Component\\Catalog\\ProductValue\\MetricProductValue/Pim\\Component\\Catalog\\Value\\MetricValue/g'
find ./src/ -type f -print0 | xargs -0 sed -i 's/Pim\\Component\\Catalog\\ProductValue\\OptionProductValue/Pim\\Component\\Catalog\\Value\\OptionValue/g'
find ./src/ -type f -print0 | xargs -0 sed -i 's/Pim\\Component\\Catalog\\ProductValue\\OptionsProductValue/Pim\\Component\\Catalog\\Value\\OptionsValue/g'
find ./src/ -type f -print0 | xargs -0 sed -i 's/Pim\\Component\\Connector\\ArrayConverter\\FlatToStandard\\ProductValue/Pim\\Component\\Connector\\ArrayConverter\\FlatToStandard\\Value/g'
find ./src/ -type f -print0 | xargs -0 sed -i 's/Pim\\Component\\Enrich\\Converter\\EnrichToStandard\\ProductValueConverter/Pim\\Component\\Enrich\\Converter\\EnrichToStandard\\ValueConverter/g'
find ./src/ -type f -print0 | xargs -0 sed -i 's/Pim\\Component\\Enrich\\Converter\\StandardToEnrich\\ProductValueConverter/Pim\\Component\\Enrich\\Converter\\StandardToEnrich\\ValueConverter/g'
find ./src/ -type f -print0 | xargs -0 sed -i 's/Pim\\Component\\ReferenceData\\Factory\\ProductValue\\ReferenceDataCollectionProductValueFactory/Pim\\Component\\ReferenceData\\Factory\\Value\\ReferenceDataCollectionValueFactory/g'
find ./src/ -type f -print0 | xargs -0 sed -i 's/Pim\\Component\\ReferenceData\\Factory\\ProductValue\\ReferenceDataProductValueFactory/Pim\\Component\\ReferenceData\\Factory\\Value\\ReferenceDataValueFactory/g'
find ./src/ -type f -print0 | xargs -0 sed -i 's/Pim\\Component\\ReferenceData\\ProductValue\\ReferenceDataCollectionProductValue/Pim\\Component\\ReferenceData\\Value\\ReferenceDataCollectionValue/g'
find ./src/ -type f -print0 | xargs -0 sed -i 's/Pim\\Component\\ReferenceData\\ProductValue\\ReferenceDataProductValue/Pim\\Component\\ReferenceData\\Value\\ReferenceDataValue/g'
find ./src/ -type f -print0 | xargs -0 sed -i 's/Pim\\Bundle\\CatalogBundle\\DependencyInjection\\Compiler\\RegisterProductValueValueFactoryPass/Pim\\Bundle\\CatalogBundle\\DependencyInjection\\Compiler\\RegisterValueFactoryPass/g'

## Services
find ./src/ -type f -print0 | xargs -0 sed -i 's/pim_catalog\.factory\.product_value/pim_catalog\.factory\.value/g'
find ./src/ -type f -print0 | xargs -0 sed -i 's/pim_catalog\.factory\.product_value_collection/pim_catalog\.factory\.value_collection/g'
find ./src/ -type f -print0 | xargs -0 sed -i 's/pim_catalog\.factory\.product_value\.text/pim_catalog\.factory\.value\.text/g'
find ./src/ -type f -print0 | xargs -0 sed -i 's/pim_catalog\.factory\.product_value\.textarea/pim_catalog\.factory\.value\.textarea/g'
find ./src/ -type f -print0 | xargs -0 sed -i 's/pim_catalog\.factory\.product_value\.number/pim_catalog\.factory\.value\.number/g'
find ./src/ -type f -print0 | xargs -0 sed -i 's/pim_catalog\.factory\.product_value\.boolean/pim_catalog\.factory\.value\.boolean/g'
find ./src/ -type f -print0 | xargs -0 sed -i 's/pim_catalog\.factory\.product_value\.identifier/pim_catalog\.factory\.value\.identifier/g'
find ./src/ -type f -print0 | xargs -0 sed -i 's/pim_catalog\.factory\.product_value\.metric/pim_catalog\.factory\.value\.metric/g'
find ./src/ -type f -print0 | xargs -0 sed -i 's/pim_catalog\.factory\.product_value\.price_collection/pim_catalog\.factory\.value\.price_collection/g'
find ./src/ -type f -print0 | xargs -0 sed -i 's/pim_catalog\.factory\.product_value\.option/pim_catalog\.factory\.value\.option/g'
find ./src/ -type f -print0 | xargs -0 sed -i 's/pim_catalog\.factory\.product_value\.options/pim_catalog\.factory\.value\.options/g'
find ./src/ -type f -print0 | xargs -0 sed -i 's/pim_catalog\.factory\.product_value\.file/pim_catalog\.factory\.value\.file/g'
find ./src/ -type f -print0 | xargs -0 sed -i 's/pim_catalog\.factory\.product_value\.image/pim_catalog\.factory\.value\.image/g'
find ./src/ -type f -print0 | xargs -0 sed -i 's/pim_catalog\.factory\.product_value\.date/pim_catalog\.factory\.value\.date/g'
find ./src/ -type f -print0 | xargs -0 sed -i 's/pim_catalog\.model\.product_value\.interface/pim_catalog\.model\.value\.interface/g'
find ./src/ -type f -print0 | xargs -0 sed -i 's/pim_versioning\.serializer\.normalizer\.flat\.product_value/pim_versioning\.serializer\.normalizer\.flat\.value/g'

## Parameters
find ./src/ -type f -print0 | xargs -0 sed -i 's/pim_catalog\.factory\.product_value_collection\.class/pim_catalog\.factory\.value_collection\.class/g'
find ./src/ -type f -print0 | xargs -0 sed -i 's/pim_catalog\.factory\.product_value\.class/pim_catalog\.factory\.value\.class/g'
find ./src/ -type f -print0 | xargs -0 sed -i 's/pim_catalog\.factory\.product_value\.scalar\.class/pim_catalog\.factory\.value\.scalar\.class/g'
find ./src/ -type f -print0 | xargs -0 sed -i 's/pim_catalog\.factory\.product_value\.metric\.class/pim_catalog\.factory\.value\.metric\.class/g'
find ./src/ -type f -print0 | xargs -0 sed -i 's/pim_catalog\.factory\.product_value\.price_collection\.class/pim_catalog\.factory\.value\.price_collection\.class/g'
find ./src/ -type f -print0 | xargs -0 sed -i 's/pim_catalog\.factory\.product_value\.option\.class/pim_catalog\.factory\.value\.option\.class/g'
find ./src/ -type f -print0 | xargs -0 sed -i 's/pim_catalog\.factory\.product_value\.options\.class/pim_catalog\.factory\.value\.options\.class/g'
find ./src/ -type f -print0 | xargs -0 sed -i 's/pim_catalog\.factory\.product_value\.media\.class/pim_catalog\.factory\.value\.media\.class/g'
find ./src/ -type f -print0 | xargs -0 sed -i 's/pim_catalog\.factory\.product_value\.date\.class/pim_catalog\.factory\.value\.date\.class/g'
find ./src/ -type f -print0 | xargs -0 sed -i 's/pim_serializer\.normalizer\.flat\.product_value\.class/pim_serializer\.normalizer\.flat\.value\.class/g'
find ./src/ -type f -print0 | xargs -0 sed -i 's/pim_catalog\.entity\.product_value\.scalar\.class/pim_catalog\.entity\.value\.scalar\.class/g'
find ./src/ -type f -print0 | xargs -0 sed -i 's/pim_catalog\.entity\.product_value\.media\.class/pim_catalog\.entity\.value\.media\.class/g'
find ./src/ -type f -print0 | xargs -0 sed -i 's/pim_catalog\.entity\.product_value\.metric\.class/pim_catalog\.entity\.value\.metric\.class/g'
find ./src/ -type f -print0 | xargs -0 sed -i 's/pim_catalog\.entity\.product_value\.option\.class/pim_catalog\.entity\.value\.option\.class/g'
find ./src/ -type f -print0 | xargs -0 sed -i 's/pim_catalog\.entity\.product_value\.options\.class/pim_catalog\.entity\.value\.options\.class/g'
find ./src/ -type f -print0 | xargs -0 sed -i 's/pim_catalog\.entity\.product_value\.date\.class/pim_catalog\.entity\.value\.date\.class/g'
find ./src/ -type f -print0 | xargs -0 sed -i 's/pim_catalog\.entity\.product_value\.price_collection\.class/pim_catalog\.entity\.value\.price_collection\.class/g'
find ./src/ -type f -print0 | xargs -0 sed -i 's/pim_enrich\.converter\.standard_to_enrich\.product_value\.class/pim_enrich\.converter\.standard_to_enrich\.value\.class/g'
find ./src/ -type f -print0 | xargs -0 sed -i 's/pim_enrich\.converter\.enrich_to_standard\.product_value\.class/pim_enrich\.converter\.enrich_to_standard\.value\.class/g'
find ./src/ -type f -print0 | xargs -0 sed -i 's/pim_reference_data\.factory\.product_value\.reference_data\.class/pim_reference_data\.factory\.value\.reference_data\.class/g'
find ./src/ -type f -print0 | xargs -0 sed -i 's/pim_reference_data\.factory\.product_value\.reference_data_collection\.class/pim_reference_data\.factory\.value\.reference_data_collection\.class/g'
find ./src/ -type f -print0 | xargs -0 sed -i 's/pim_reference_data\.product_value\.reference_data\.class/pim_reference_data\.value\.reference_data\.class/g'
find ./src/ -type f -print0 | xargs -0 sed -i 's/pim_reference_data\.product_value\.reference_data_collection\.class/pim_reference_data\.value\.reference_data_collection\.class/g'

Building the front-end with webpack

  1. Install nodejs (tested with >=6.11.0 until 8.2.1) and npm 5.0.3, you can follow the instructions here - https://nodejs.org/en/download/package-manager/ or install with homebrew - brew install node@6 should install both these versions.
  2. Run php bin/console pim:installer:dump-require-paths
  3. Run php bin/console assets:install --symlink
  4. Run npm install inside your project root
  5. Run npm run webpack
  6. Run php bin/console cache:clear
  7. Add to your .gitignore the following lines:
  node_modules
  web/dist/*
  web/cache/*
  npm-debug.log

If you have any custom Javascript you will need to make the following changes:

When you require a html template inside a module, you no longer have to use the text! prefix. This is handled in webpack.config.js.

Before:

define([
    'text!oro/template/system/tab/system'
],

After:

define([
    'oro/template/system/tab/system'
],

Instead of using module.config() to access module configuration, you must instead use __moduleConfig.

Before:

    Routing.generate(module.config().url, {identifier: datagridView.id});

After:

    Routing.generate(__moduleConfig.url, {identifier: datagridView.id});

You can now write custom Javascript using es2017 (es2015 and above) syntax. We use babel to transpile the JS during the webpack build step. Check out the full guide here - https://babeljs.io/learn-es2015/

While you are developing custom Javscript, you can run npm run webpack-watch to automatically compile and refresh your changes. Otherwise, you can run npm run webpack without refresh to see your changes. This command will also minify your code.