Skip to content

Latest commit

 

History

History
81 lines (53 loc) · 2.62 KB

customize-install.rst

File metadata and controls

81 lines (53 loc) · 2.62 KB
orphan:

Customizing the Installation Process

To customize the installation process and modify the database structure and/or data that are loaded in the OroCommerce after installation, you can:

You can create your own :ref:`migrations <backend-entities-migrations>` that can be executed during the installation. A migration is a class which implements the Oro\Bundle\MigrationBundle\Migration\Migration interface:

namespace Acme\Bundle\DemoBundle\Migrations\Schema\v1_0;

use Doctrine\DBAL\Schema\Schema;
use Oro\Bundle\MigrationBundle\Migration\Migration;
use Oro\Bundle\MigrationBundle\Migration\QueryBag;

class CustomMigration implements Migration
{
    #[\Override]
    public function up(Schema $schema, QueryBag $queries)
    {
        // ...
    }
}

Note

Entity metadata in the PHP entity classes (attributes) should exactly match what the schema migration is doing. If you create a migration that modifies the type, length, or another property of an existing entity field, please remember to make the same change in the PHP entity class attributes.

In the Oro\Bundle\MigrationBundle\Migration\Migration::up, you can modify the database schema and/or add additional SQL queries executed before and after the schema changes.

To load your own data :ref:`fixtures <backend-entities-fixtures>`, you will need to implement Doctrine's "FixtureInterface":

namespace Acme\Bundle\DemoBundle\Migrations\Data\ORM;

use Doctrine\Common\DataFixtures\FixtureInterface;
use Doctrine\Persistence\ObjectManager;

class CustomFixture implements FixtureInterface
{
    #[\Override]
    public function load(ObjectManager $manager)
    {
        // ...
    }
}

Caution!

Your data fixture classes must reside in the "Migrations/Data/ORM" sub-directory of your bundle to be loaded automatically during the installation.

Tip

Read the |doctrine data fixtures documentation| to learn more about the Doctrine Data Fixtures extension.