

How to Generate Propel’s Schema.xml File From a Database Model Created in Vertabelo
If you use Propel, you can now generate a Propel schema file from a database model created in Vertabelo.
Propel is a popular ORM (Object-Relational Mapping) library for PHP. In Propel, the datamodel structure is described by a special schema XML file. From this schema Propel generates PHP object model classes which Propel uses to represent rows in your tables.
VertabeloPropel is a PHP script which converts a Vertabelo XML file into Propel’s schema.xml file.
Installation
VertabeloPropel uses Composer to manage project dependencies.
In your project directory create a file composer.json:
{ "require": { "vertabelo/vertabelo-propel": "*" } }
Run Composer install.
composer install
This will download VertabeloPropel into the vendor directory in your project directory. The script will be in vendor/bin/vertabelo-propel.php file or, for Windows, in vendor\bin\vertabelo-propel.php.bat.
How to Use VertabeloPropel
Create a new or open an existing database model in Vertabelo.
If you don’t have your Vertabelo account yet, you can sign up for a free trial. Notice that Vertabelo is completely free for students and lecturers. The academic registration is available here.
Here is a sample database model which I prepared earlier:
Download the model as an XML file and save it in your project directory.
Generate Propel’s schema.xml file. If you want to use the default settings (input file model.xml, output file schema.xml, database name test, default id method native), run
in Windows
vendor\bin\vertabelo-propel.php.bat
in Mac/Linux
vendor/bin/vertabelo-propel.php
If you want to change the defaults, run
in Windows
vendor\bin\vertabelo-propel.php.bat -i model.xml -o schema.xml / --database-name bookshop ---default-id-method native
in Mac/Linux
vendor/bin/vertabelo-propel.php -i model.xml -o schema.xml --database-name bookshop --default-id-method native
The script generates Propel’s schema.xml file.
Proceed with your normal Propel application development (or see our HOWTO).
Script Options
The script options are:
- --input-file (shortcut -i) location of Vertabelo XML file (default value “model.xml”)
- --output-file (shortcut -o) location of output Propel schema.xml file (default value “schema.xml”)
- --database-name name of the database (default value “test”)
- --default-id-method database's defaultIdMethod. Allowed values are “native” or “none”, default value is “native”.
- --help prints the help message