crazedCoders PHP 5.5.2/Cairngorm 2_2_1/Flex 2.01 Code Generator

Enter your default package (i.e. com.crazedcoders.testapp)
Enter your MySQL server name or IP Address
Enter your MySQL database name
Enter your MySQL username (requires full rights to db)
Enter your MySQL password
Notes
  • You can get the version of AMFPHP1.9Beta that we used to test this generator here, for more info click here.
  • To speed things up consider installing the phpamf C extension for AMF by Emanuele Ruffaldi, also available here.
  • We tested our generator against MySQL version 5.0.x, which you can get here.
  • We're big fans and avid users of Cairngorm, and the generated flex project comes packaged with the latest version of the Cairngorm library, version 2.2.1. You can read more about Cairngorm here.
  • The provided default values will work, so if you don't feel comfortable exposing your mysql server at this time, just click submit and grab the sample generated zip file! You can get this test database's sql create script here test.sql!
  • Jan8-08 Update: Fixed Issue: Date Validators not working properly
  • Jan8-08 Update: Fixed Issue: Dates not saving to mysql, no errors being returned on failed insert
  • Jan8-08 Update: Changed how bit/tiny int are handled on update/insert
  • Update: Flexbuilder project files were not properly getting included in the generated zip file. This has been fixed.
  • Jan6-08 Update: Fixed Issue: Library path to cairngorm was not set correctly in .actionscriptproperties file
  • Jan6-08 Update: Fixed Issue: If column names used reserved words or had "_" the generated DAO code would fail
  • Jan6-08 Update: Fixed Issue: Namespace conflicts alleviated by forcing lower case on all provided values
  • Jan6-08 Update: Changed wording in instructions
  • Jan6-08 Update: Changed default setting in services-config.xml to point to http://localhost/flashservices

Requirements

The code generator runs on our server, which means that in order for this to work, our server will need to be able to connect to your mysql server. That means the IP address or domain name of your mysql server must be publicly accessible. IP Addresses like 192.168.100.1 and server names like momspc won't work. If you are behind a firewall and/or router, you will need to either map port 3306 through to your computer, or place your computer's IP Address in the DMZ of your firewall/router. This of course need only be a temporary measure, once the wizard runs you can quickly seal things up again. Alternatively you could plug your mysql machine directly into your modem, and bypass the firewall/router. If you are using Windows XP, also make sure that your Windows Firewall allows incoming traffic on port 3306. If you need to figure out what your public IP address is and you are on your mysql server, visit a site like this one http://myipaddress.com to get that information.

The username and password you provide must have sufficient rights to query the INFORMATION_SCHEMA of your mysql database, otherwise the generator will fail.

To use the generate php code you will need to install php and amfphp on your webserver. We've tested this on Apache 2.2 and IIS 6 and have not encountered any issues (although getting php work on IIS 6 was not fun).

Output

Once the generator is complete you will be provided a link to a zip file and some instructions on what to do next. The zip file has 2 directories amfphp and dbname_flex. The dbname_flex contains your flex project and is the folder that you should point to when import the project into Flexbuilder. The afmphp folder contains a services folder, the contents of which you must copy over into your amfphp/services folder. We do take your db connection information and insert it into the generated php class so that you could technically keep working however you might well need to change it. How to change it is outlined on the generated results page.

Background
Although we are still adding features, the code generator seems quite stable. It will basically query the schema of a database and determine relationships between all the tables and then build all the php code required to speak to the database. Also, it creates a complete cairngorm structured flex application, with tabbed fully functional views for each non-mapping table, events, commands, and services. It also creates all the project files for Flexbuilder, so you can easily and quickly import the project as is into Flexbuilder, regenerate the html-template folder, compile and run.
Features
  • GetCount(), GetAllRecords(), GetOneRecord(), Create(), Update(), Delete()
  • Support for Numeric, Date, Text and Int fields
  • Datepickers, Comboboxes (for lookup tables), checkboxes
  • Validators on Numeric and Date fields
  • Full AMF3 Remote Object support - passing of strongly typed objects to and from PHP
  • Absolutely no styling applied, with the exception of some widths and heights
  • Absolutely no use of Delegates as per the true Cairngorm model... we're lazy we just do it all in our Command classes
  • Two way binding on all form fields
  • Datagrid Views
  • Paged/Index Get Record Retrieval Support
Future Features
  • Support for more data types
  • Delegate Classes
  • Support for Flex 3
  • AIR Application Generator
  • MSSQL Support (partially complete)
Code generator source available?
Sure http://code.google.com/p/flexamfphpcairnormgenerator/source