Important
You are browsing the documentation for version 4.2 of OroCommerce, OroCRM and OroPlatform, which is no longer maintained. Read version 5.1 (the latest LTS version) of the Oro documentation 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 match exactly 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 that are 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.