Important
You are browsing documentation for version 5.0 of OroCommerce, supported until January 2025. Read the documentation for version 6.0 (the latest LTS version) to get up-to-date information.
See our Release Process documentation for more information on the currently supported and upcoming releases.
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:
Execute Custom Migrations
You can create your own migrations that can be executed during the installation.
A migration is a class which implements the Oro\Bundle\MigrationBundle\Migration\Migration
interface:
namespace Acme\DemoBundle\Migration\1_0;
use Doctrine\DBAL\Schema\Schema;
use Oro\Bundle\MigrationBundle\Migration\Migration;
use Oro\Bundle\MigrationBundle\Migration\QueryBag;
class CustomMigration implements Migration
{
public function up(Schema $schema, QueryBag $queries)
{
// ...
}
}
Note
Entity metadata in the PHP entity classes (annotations) 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 annotations.
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.
Load Custom Data Fixtures
To load your own data fixtures, you will need to implement Doctrine’s “FixtureInterface”:
namespace Acme\DemoBundle\Migrations\Data\ORM;
use Doctrine\Common\DataFixtures\FixtureInterface;
use Doctrine\Persistence\ObjectManager;
class CustomFixture implements FixtureInterface
{
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.