Skip over navigation
Documentation
You are currently viewing documentation for a previously released version of OroCommerce. See the latest long-term support version.

How to Generate an Installer for a Bundle

When you have implemented new entities, you want to be sure that upon installing the application, the entities are added to the database. For this, you need to create an installer. You can do it manually, however, it is more convenient to use a dump of the database as a template.

To create an installer for AcmeBundle:

  1. Clear the application cache:

    1
    app/console cache:clear
    
  2. Apply the changes that you defined in your code to the database:

    1
    bin/console doctrine:schema:update
    
  3. Generate an installer and save it to the AcmeBundleInstaller.php:

    1
    app/console oro:migration:dump --bundle=AcmeBundle > AcmeBundleInstaller.php
    

    Hint

    The generated installer may contain a lot of excessive information as the same database table might contain options related to different bundles and entities while the generator has no option to distinguish which entity ‘has added’ particular options. Delete the information unrelated to your entities from the output file.

Move AcmeBundleInstall.php to the AcmeBundle/Migrations/Schema directory.
  1. Reinstall your application instance.

  2. Check that the database is synced with your code:

    1
    app/console doctrine:schema:update --dump-sql
    

    If the database is successfully synchronized, you will see the following message:

    1
    Nothing to update - your database is already in sync with the current entity metadata.
    
ForumsForums
Back to top