|
Value Objects and Data Access Objects with PHP 4.2.x
The Base Value Object
The Base VO has a number of methods that assist in reading forms. Another method that could be
implemented here might be a date formatting method. Different databases return date values in
many different formats. To keep consistency, you may want to do some string manipulation with
the date values to keep them all looking the same.
The Extended Value Object
The VehicleVO class has five properties that reflect the five columns in the vehicles table.
A default constructor exists to create an empty VO or if given arguments, a VO filled with data:
<?php
// create a new VO
function VehicleVO($vehicleid= 0, $year= "", $make= "",
$model= "", $color= "", $price= 0.00)
{
$this->vehicleid = $vehicleid;
$this->year = $year;
$this->make = $make;
$this->model = $model;
$this->color = $color;
$this->price = $price;
}
?>
Other methods the VO includes are:
[ Next Page ]- function equals($vo) -
- Compares itself to another VehicleVO object. Returns true or false.
- function copy($vo) -
- Copies the contents of another VehicleVO object.
- function readForm() -
- Reads values from the $_POST array.
- function readQuery() -
- Reads values from the $_GET array.
- function toXML() -
- Returns a string that contains it's data represented as an XML node.
- function toString()-
- Returns a string that contains a delimited line of data.
- function getPK() -
- Return the value of the primary key field.
| Comments: | ||
| RE: Code Fix | Jayee | 08/09/08 17:01 |
| Security "ouch!" at the form part... | Dave | 10/04/07 09:20 |
| Code Fix | Jason | 10/30/05 15:36 |
| php script | olipa | 03/30/05 05:04 |
| one detail | Israel Dominguez | 01/28/05 15:11 |
| PHP Best Practices | Jeroen | 10/16/04 04:32 |
| RE: php code | Pests | 06/22/04 14:01 |
| Small problem | Lonnie Olson | 06/02/04 19:03 |
| Interesting but where are all the files? | Henrik | 06/02/04 12:47 |
| php code | Simon | 06/02/04 02:44 |
|
If you are looking for help, please post on the appropriate forum here. Your questions will be answered much more quickly. | ||


