UML2.1 to Php generator
UML2.1 to Php generator.
The goal of this generator is to produce a PHP5 application using PEAR Framework and SMARTY templates engine.
PHP5 application generation
This demonstration shows how to generate a PHP5 application with an UML2 model.
Use of the generated code
This demonstration illustrates how to use the generated code, implementing the following features :
Modification of the model and regeneration of the code.
Here is the demonstration of the incremental generation. This functionality is illustrated by adding a 'nickName' attribute to the 'Author' class .
This module generates a PHP5 application structured with layers :
DAO layer with PEAR DB Framework
DAO layer is made up of classes allowing the application to execute queries to a data base. All DBMS supported by PEAR DB Framework are compliant with the generated application. A DAO class is created for each business object.
The generator deals with :
Business Objects are POJO having attributes and corresponding getters/setters. With an aim of facilitated the application development, classes managing lazy loading are generated using the Proxy Design Pattern.
The Presentation layer of the generated application presents the following characteristics :
Operation and use of the module.
The generator produce code from UML2.1 models enhanced with a few stereotypes.
The input model
The generator uses classes of the input model to generate the PHP 5 application.
We identify two kinds of class :
Files generated from one classe having a stereotype named Entity.
Files generated from one classe having a stereotype named Screen.
Others generated files
The installation process is explained on the Installing a generative module page . The generated application needs PEAR Framewark and SMARTY templates engine.
As soon as the generator is installed, you may quickly test it's working nicely. Create a new project (an empty project or PHP project if you installed the PDT plugin).
Choose the File menu entry then New and Other....
In the Acceleo category pick Module Launcher.
The installed modules is then available. Choose the "UML2 to Php" module then click on "next". Fill in the parameter fields
Once the wizard is finished it will create a .chain file allowing you to launch the generation and it will initialize a default Ecore model.
Right-clicking on the .chain file the Launch button will kick off the generation process. You'll find the generated PHP files in the folder you choosed with the wizard.
If you want to change or complete the generative templates you may use the a Team Project Set file. Using this file you'll be able to import the module sources right from the Subversion repository inside your Eclipse.Team Project Set file for PHP module
The getting and modifying generator module sources page explains how to use this file.