Pork.Generator

Presenting, after many, many hours of coding:


Pork.Generator 1.0


Pork.Generator is a webbased tool to inspect your databases and generate Pork.dbObject based code. The generator analyzes the relations in your database, by trying to match primary keys to fields of other tables. If you have created your table structure following some simple rules, this project can either create a complete CRUD (Create, Read, Update, Delete) interface into a .zip file, or just output your complete database schema into O/R mapped objects.

Pork.dbObject is an Object-Relation mapper for PHP 5 that attempts to be easy, fast, lightweight, uses optimized database queries and provides an easy Find() function very loosely based on rails'. For more information on Pork.dbObject please go here


Features of Pork.Generator 1.0

* Inspect the relations and properties of tables in your database in an MDI interface
* Generate a complete CRUD web-interface of your database
* CRUD interface has the ability to visually create connections between any defined relations
* Generate just classes with relations mapped between them for the tables found in your database
* Generate just the class you're inspecting right now
* Visualize the relations between tables in your database via GraphViz
* Semi-intelligent entity object naming (if you have an ID_Image object in your Images table the object will be named Image)
* Create custom mappings for fields in tables to internal object mapping
* Set database-wide generation options (create only constructor, create editor, display and displayShort functions)
* Interface generation is completely customizable. You can include your own stuff and work in your own favorite way!
* Includes custom PHP formgenerator, MooTools 1.2 beta, Mocha UI, FCKEditor, MooCalendar

Requirements of Pork.Generator 1.0
* Built for FireFox. IE is known to look *nasty* and not currently actively supported
* PHP5, Apache, MySQL
* Graphviz ( http://www.graphviz.org ) for graphical display of the relations between tables

Known limitations
* For now relations in Pork.dbObject are based solely on the case sensitivie naming of properties with a PRI flag in MySQL.
tableA.ID_This + tableB.ID_This = relation
* There is no analysation of any MySQL-defined relations or foreign keys, and relations in the form of tableA.ID + tableB.tableaID are not supported. This will be added in future versions of Pork.dbObject and the generator.
* The code behind the VirtualObject and ClassGenerator in the analyzer needs major rewriting to allow for more simple plugins, but it just works, and has done so for the last 2 years, so I decided to release it.

Screenshots
http://www.schizofreend.nl/images/demo1thumb.jpg Welcome screen
http://www.schizofreend.nl/images/demo2thumb.jpg Database and table overview
http://www.schizofreend.nl/images/demo3thumb.jpg Table editor tab and relations tab
http://www.schizofreend.nl/images/demo4thumb.jpg Generated code
http://www.schizofreend.nl/images/demo5thumb.jpg More generated code
http://www.schizofreend.nl/images/demo6thumb.jpg Global code generation

Graphviz generated relation maps:
example 1 example 2 example 3

Demo: http://www.schizofreend.nl/demogenerator
Download: http://code.google.com/p/pork-generator/downloads/list