Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > PHP/MySQL > PHP Databases
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
PHP Databases Using PHP in conjunction with databases. PHP questions not specific to databases should be directed to one of the other PHP forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP Databases section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old January 9th, 2015, 07:34 AM
Registered User
Points: 5, Level: 1
Points: 5, Level: 1 Points: 5, Level: 1 Points: 5, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2014
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Generating Propel's schema.xml file from a database model created in Vertabelo

PHP developers who use Propel to access their databases now can generate Propel's schema.xml file from database model created in Vertabelo (a popular online tool for visual database design). I recommend Vertabelo because it offers free subscription for small projects and it's completely free for teachers and students.

Once you create a model of your database in Vertabelo, you can generate a Propel schema file from it. To do this you'll have to use VertabeloPropel, a PHP script which converts a Vertabelo XML file into Propel's schema.xml file. The script is available on GitHub.

Installing

VertabeloPropel uses Composer to manage project dependencies.

In your project directory create a file composer.json:

Code:
{
"require": {
"vertabelo/vertabelo-propel": "*"
   }
}
Then run Composer install.

Code:
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.

Using VertabeloPropel script

1. Create a database model with Vertabelo.

2. Download the model as an XML file and save it in your project directory (use an option "Export model as XML file" from Vertabelo's tool bar).

3. 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

Code:
vendor\bin\vertabelo-propel.php.bat
in Mac/Linux

Code:
vendor/bin/vertabelo-propel.php
If you want to change the defaults, run

in Windows

Code:
vendor\bin\vertabelo-propel.php.bat -i model.xml -o schema.xml /
   --database-name bookshop ---default-id-method native
in Mac/Linux

Code:
vendor/bin/vertabelo-propel.php -i model.xml -o schema.xml --database-name bookshop --default-id-method native
4. The script generates Propel's schema.xml file.

5. Proceed with your normal Propel application development (or see "How to develop a PHP+MySQL application with Propel and Vertabelo").

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

---------------

The above information was originaly published on Vertabelo's blog.
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
What do you do if you've left stuff out of the model, when generating controllers? rfalanga BOOK: Professional ASP.NET MVC 5 2 January 7th, 2015 03:23 PM
Ch 14 generating entity model AlanWheeler BOOK: Beginning ASP.NET 4.5 : in C# and VB 2 April 30th, 2014 07:51 AM
Generating HTML Report from xml input file using stylesheet debu37 XSLT 0 September 17th, 2013 02:38 PM
Extending an XML Schema content model stolte XML 3 June 24th, 2010 02:16 PM
Save database schema to XML file brettk_1 General .NET 2 September 16th, 2006 04:27 AM



All times are GMT -4. The time now is 07:37 AM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.