How to Define my own Data Set with the Installer

The Akeneo PIM allows to prepare a data set to use during the installation.

You can configure the data set in the app/config/parameters.yml file:

1
2
3
# /app/config/parameters.yml
parameters:
    installer_data: PimInstallerBundle:icecat_demo_dev # use PimInstallerBundle:minimal for minimal data set

The following steps allow you to easily define your own basic entities when you install the PIM.

Create a Bundle

Create a new bundle:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
# /src/Acme/Bundle/InstallerBundle/AcmeInstallerBundle.php
<?php

namespace Acme\Bundle\InstallerBundle;

use Symfony\Component\HttpKernel\Bundle\Bundle;

class AcmeInstallerBundle extends Bundle
{
}

Register it into AppKernel.php:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
# /app/AppKernel.php
<?php

use Symfony\Component\Config\Loader\LoaderInterface;
use Oro\Bundle\DistributionBundle\OroKernel;

class AppKernel extends OroKernel
{
    /**
     * {@inheritdoc}
     */
    public function registerBundles()
    {
        $bundles = array();

        // Add my own bundles
        $bundles[] = new Acme\Bundle\InstallerBundle\AcmeInstallerBundle();

        return $bundles;
    }
}

Add your own Data

Create a directory Resources/fixtures/mydataset in your bundle.

Copy the *.yml and *.csv files from Installer bundle into the mydataset directory of your bundle.

Then edit the files, for example, to declare your own channels:

1
2
3
4
5
6
7
8
9
# /src/Acme/Bundle/InstallerBundle/Resources/fixtures/mydataset/channels.yml
channels:
    default:
        label: Default
        locales:
            - en_US
        currencies:
            - USD
        tree: default

Tip

Take a look at Pim/Bundle/InstallerBundle/Resources/fixtures/minimal to see what is the expected format and which fixtures are absolutely needed. All fixtures can be created in CSV or YAML.

Install the DB

Update the app/config/parameters.yml to use your data set:

1
2
3
# /app/config/parameters.yml
parameters:
    installer_data: 'AcmeInstallerBundle:mydataset'

You can now (re)install your database by running:

> php app/console pim:install --force --env=dev --task=db

Load individual fixture files

Fixture files can be loaded individually by using the pim:installer:load-fixtures command :

> php app/console pim:installer:load-fixtures src/Acme/Bundle/InstallerBundle/Resources/fixtures/mydataset/*

Note

The fixtures files can be loaded multiple times, objects will be updated instead of being created on successive calls. This command also takes care of loading the fixtures in the right order.