PHP Classes
elePHPant
Icontem

DbCodeBuilder: Generate code to access databases as data objects

Recommend this page to a friend!
  Info   View files View files (8)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2007-10-11 (9 years ago) RSS 2.0 feedStarStarStarStar 62%Total: 1,602 All time: 2,380 This week: 1,090Up
Version License PHP version Categories
dbcodeassist 0.2Artistic License5.0PHP 5, Databases, Code Generation
Description Author

This package can be used to generate code for classes to access databases as objects.

It accesses a database to retrieve the information about tables and columns for which it is intended to generate data access classes.

It generates value object classes (VO) to manage the mapped object information with all the necessary getter and setter functions.

It also generates data object class (DAO) to perform the actual database access operations at application runtime, like INSERT, SELECT, UPDATE, and DELETE.

Picture of Christian Velin
Name: Christian Velin <contact>
Classes: 1 package by
Country: Sweden Sweden

Details
README
The code generated by this software was deeply inspired by this article:
http://www.odi.ch/prog/design/php/guide.php

VERSION HISTORY
Since 0.1
- Implemented phpdoc tags on all generated code
- Implemented full OO code in the script and in the generated code.


REQUIREMENTS
There are a few things that this code will not do and there are a few things to consider when using the generated code:

1. The code require your tables to be constructed a certain way. The first column in every table should be the primary key of the table, setting the primary key on any other column will render useless code. This is a bug and it will be resolved in version 0.3.

2. The generated code does not support primary key columns without AUTO_INCREMENT set, which basically means that no id is generated in the php code, but must be generated by the db itself, this issue will also be adressed in version 0.3.

3. A VO is an exact replication of a single table row and should therefore be treated in much the same way you treat data in a table. Do not blindly insert data into it, since there is no logic to check or verify it. Use regular PHP methods to escape hazardous characters and ALWAYS verify input from forms before submitting the data to a VO.

4. The generated VOs does not contain a constructor which would allow for easier creation of VOs, and would reduce the risk of creating a defective VO. The implementation of such a constructor is planned for version 0.3, as of now the only way to create a proper VO is with the "setter" methods.
  Files folder image Files  
File Role Description
Files folder imageresult (2 files)
Accessible without login Plain text file README Doc. Readme file with guidelines and important points
Accessible without login Plain text file LICENSE Lic. Artistic license
Accessible without login Plain text file AccessBuilder.class.php Class DB info collector class
Accessible without login Plain text file DAOFormatter.class.php Class Code generator for DAOs
Accessible without login Plain text file VOFormatter.class.php Class Code generator for VOs
Accessible without login Plain text file index.php Example Code examples

  Files folder image Files  /  result  
File Role Description
  Plain text file User.dao.php Output The DAO file produced for the User table.
  Plain text file User.vo.php Output The Vo file produced by the User table.

 Version Control Unique User Downloads Download Rankings  
 0%
Total:1,602
This week:0
All time:2,380
This week:1,090Up
 User Ratings  
 
 All time
Utility:81%StarStarStarStarStar
Consistency:81%StarStarStarStarStar
Documentation:68%StarStarStarStar
Examples:68%StarStarStarStar
Tests:-
Videos:-
Overall:62%StarStarStarStar
Rank:934