Your Tables as PHP Objects
The Code Generator will more or less create a PHP object for each table in your database.
For our three main tables (
login,
person and
project), the Code Generator
created the following PHP classes:
- Login
- LoginGen
- Person
- PersonGen
- Project
- ProjectGen
LoginGen,
PersonGen and
ProjectGen are the generated classes
which contain all the code to handle your database CRUD (create, restore, update
and delete) functionality. The
Login,
Person and
Project
classes inherit from the generated classes, and they are known as custom
subclasses.
Note that on any subsequent code generation, while the generated classes will be overwritten,
the custom subclasses will not be touched. So you should feel free to make changes
to these custom subclasses, override methods, introduce additional functionality, etc.
as well as re-execute the code generator at any time. Your changes and class customizations
will remain intact.
For every object, the Code Generator will generate the getter and setter properties for each
of the attributes in the table. It will also generate the following basic CRUD methods:
- Load
- LoadAll
- CountAll
- Save
- Delete
The example below shows how we can use the
Load and
LoadAll methods and the
properties to view some the data. Feel free to
View Source to view the PHP code
for
objects.php which makes these calls.
Displaying the Properties of a Project
Project ID: 2
Project Name: State College HR Sxzxxystem
Project Decsription: Implementation of a back-office Human Resources system for State College
Project Start Date: Feb 15 2006
Project End Date:
Project Budget: 80500
Using LoadAll to get an Array of Person Objects
• P.A.M.ELA Dirac
• Kendalll Jenner
• Ben Robinson
• Mike Ho
• Alejnadro Smith
• Wendy jose
• Karen Wolfe
• Samantha prueba
• Linda Brady
• Jennifer Smith
• Brett Smiths
• Jacob Pratt
• wdt t
• w w
• w wwwgggggggg
• asd asd
• sdfsdf sdfsdfsdf
• kalle kula
• df df
Using CountAll to get a Count of All Persons in the Database
There are 19 person(s) in the system.